summaryrefslogtreecommitdiff
path: root/tex/context/modules/mkiv
diff options
context:
space:
mode:
Diffstat (limited to 'tex/context/modules/mkiv')
-rw-r--r--tex/context/modules/mkiv/m-asymptote.lua48
-rw-r--r--tex/context/modules/mkiv/m-asymptote.mkiv143
-rw-r--r--tex/context/modules/mkiv/m-chart.lua196
-rw-r--r--tex/context/modules/mkiv/m-chart.mkvi66
-rw-r--r--tex/context/modules/mkiv/m-educat.mkiv10
-rw-r--r--tex/context/modules/mkiv/m-graph.mkiv7
-rw-r--r--tex/context/modules/mkiv/m-ipsum.mkiv1
-rw-r--r--tex/context/modules/mkiv/m-matrix.mkiv250
-rw-r--r--tex/context/modules/mkiv/m-punk.mkiv7
-rw-r--r--tex/context/modules/mkiv/m-scite.mkiv37
-rw-r--r--tex/context/modules/mkiv/m-steps.lua530
-rw-r--r--tex/context/modules/mkiv/m-steps.mkvi528
-rw-r--r--tex/context/modules/mkiv/m-visual.mkiv102
-rw-r--r--tex/context/modules/mkiv/s-characters-properties.lua83
-rw-r--r--tex/context/modules/mkiv/s-characters-properties.mkiv30
-rw-r--r--tex/context/modules/mkiv/s-domotica-settings.lua165
-rw-r--r--tex/context/modules/mkiv/s-domotica-settings.mkiv26
-rw-r--r--tex/context/modules/mkiv/s-fonts-coverage.mkiv3
-rw-r--r--tex/context/modules/mkiv/s-fonts-emoji.mkiv331
-rw-r--r--tex/context/modules/mkiv/s-fonts-features.lua77
-rw-r--r--tex/context/modules/mkiv/s-fonts-features.mkiv7
-rw-r--r--tex/context/modules/mkiv/s-fonts-missing.lua3
-rw-r--r--tex/context/modules/mkiv/s-fonts-shapes.lua28
-rw-r--r--tex/context/modules/mkiv/s-fonts-shapes.mkiv9
-rw-r--r--tex/context/modules/mkiv/s-fonts-variable.lua313
-rw-r--r--tex/context/modules/mkiv/s-fonts-variable.mkiv111
-rw-r--r--tex/context/modules/mkiv/s-inf-01.mkvi21
-rw-r--r--tex/context/modules/mkiv/s-inf-03.mkiv22
-rw-r--r--tex/context/modules/mkiv/s-languages-frequencies.lua4
-rw-r--r--tex/context/modules/mkiv/s-languages-hyphenation.lua10
-rw-r--r--tex/context/modules/mkiv/s-mag-01.mkiv505
-rw-r--r--tex/context/modules/mkiv/s-math-characters.lua6
-rw-r--r--tex/context/modules/mkiv/s-math-characters.mkiv6
-rw-r--r--tex/context/modules/mkiv/s-math-extensibles.mkiv6
-rw-r--r--tex/context/modules/mkiv/s-math-repertoire.mkiv17
-rw-r--r--tex/context/modules/mkiv/s-pre-17.mkiv4
-rw-r--r--tex/context/modules/mkiv/s-present-balls.mkiv194
-rw-r--r--tex/context/modules/mkiv/s-present-banner.mkiv132
-rw-r--r--tex/context/modules/mkiv/s-present-bars.mkiv128
-rw-r--r--tex/context/modules/mkiv/s-present-colorful.mkiv384
-rw-r--r--tex/context/modules/mkiv/s-present-common.mkiv43
-rw-r--r--tex/context/modules/mkiv/s-present-four.mkiv188
-rw-r--r--tex/context/modules/mkiv/s-present-funny.mkiv208
-rw-r--r--tex/context/modules/mkiv/s-present-fuzzy.mkiv225
-rw-r--r--tex/context/modules/mkiv/s-present-green.mkiv349
-rw-r--r--tex/context/modules/mkiv/s-present-grow.mkiv171
-rw-r--r--tex/context/modules/mkiv/s-present-organic.mkiv335
-rw-r--r--tex/context/modules/mkiv/s-present-original.mkiv397
-rw-r--r--tex/context/modules/mkiv/s-present-ovals.mkiv94
-rw-r--r--tex/context/modules/mkiv/s-present-overlap.mkiv233
-rw-r--r--tex/context/modules/mkiv/s-present-phone.mkiv108
-rw-r--r--tex/context/modules/mkiv/s-present-punk.mkiv158
-rw-r--r--tex/context/modules/mkiv/s-present-random.lua66
-rw-r--r--tex/context/modules/mkiv/s-present-random.mkiv215
-rw-r--r--tex/context/modules/mkiv/s-present-shaded.mkiv161
-rw-r--r--tex/context/modules/mkiv/s-present-simple.mkiv151
-rw-r--r--tex/context/modules/mkiv/s-present-slanted.mkiv206
-rw-r--r--tex/context/modules/mkiv/s-present-split.mkiv191
-rw-r--r--tex/context/modules/mkiv/s-present-stack.mkiv194
-rw-r--r--tex/context/modules/mkiv/s-present-stepper.mkiv227
-rw-r--r--tex/context/modules/mkiv/s-present-stepwise.mkiv216
-rw-r--r--tex/context/modules/mkiv/s-present-tiles.mkiv49
-rw-r--r--tex/context/modules/mkiv/s-present-windows.mkiv350
-rw-r--r--tex/context/modules/mkiv/s-present-wobbling.mkiv339
-rw-r--r--tex/context/modules/mkiv/s-syntax.mkiv3
-rw-r--r--tex/context/modules/mkiv/s-xml-analyzers.lua189
-rw-r--r--tex/context/modules/mkiv/s-xml-analyzers.mkiv6
-rw-r--r--tex/context/modules/mkiv/x-asciimath.lua16
-rw-r--r--tex/context/modules/mkiv/x-asciimath.mkiv122
-rw-r--r--tex/context/modules/mkiv/x-html.mkiv4
-rw-r--r--tex/context/modules/mkiv/x-math-svg.mkvi65
-rw-r--r--tex/context/modules/mkiv/x-mathml.lua1
-rw-r--r--tex/context/modules/mkiv/x-mathml.mkiv67
-rw-r--r--tex/context/modules/mkiv/x-setups-basics.mkiv279
-rw-r--r--tex/context/modules/mkiv/x-setups-overview.mkiv2
-rw-r--r--tex/context/modules/mkiv/x-setups-proofing.mkiv5
-rw-r--r--tex/context/modules/mkiv/x-steps.mkiv22
77 files changed, 9538 insertions, 667 deletions
diff --git a/tex/context/modules/mkiv/m-asymptote.lua b/tex/context/modules/mkiv/m-asymptote.lua
new file mode 100644
index 000000000..de8d032c8
--- /dev/null
+++ b/tex/context/modules/mkiv/m-asymptote.lua
@@ -0,0 +1,48 @@
+if not modules then modules = { } end modules ['m-asymptote'] = {
+ version = 1.001,
+ comment = "companion to m-pstricks.mkiv",
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "see context related readme files"
+}
+
+-- See m-asymptote.mkiv for some comment.
+
+local context = context
+local replacesuffix = file.replacesuffix
+
+moduledata.asymptote = { }
+
+sandbox.registerrunner {
+ name = "asymptote prc",
+ program = "asy",
+ method = "execute",
+ template = '-noV -config="" -tex=context -outformat="prc" "%filename%"',
+ checkers = { filename = "readable" },
+}
+
+sandbox.registerrunner {
+ name = "asymptote pdf",
+ program = "asy",
+ method = "execute",
+ template = '-noV -config="" -tex=context -outformat="pdf" "%filename%"',
+ checkers = { filename = "readable" },
+}
+
+function moduledata.asympote.process(name,type)
+ if type == "prc" then
+ local result = buffers.run(name,false,"asymptote prc","prc")
+ local jsdata = { js = replacesuffix(result,"js") }
+ local parset = parametersets[name]
+ if parset then
+ -- so we can overload at the tex end
+ setmetatableindex(parset,jsdata)
+ else
+ parametersets[name] = jsdata
+ end
+ context(result)
+ else
+ local result = buffers.run(name,false,"asymptote pdf","pdf")
+ context(result)
+ end
+end
diff --git a/tex/context/modules/mkiv/m-asymptote.mkiv b/tex/context/modules/mkiv/m-asymptote.mkiv
new file mode 100644
index 000000000..c236ceee5
--- /dev/null
+++ b/tex/context/modules/mkiv/m-asymptote.mkiv
@@ -0,0 +1,143 @@
+%D \module
+%D [ file=m-asymptote,
+%D version=2017.03.24,
+%D title=\CONTEXT\ Extra Modules,
+%D subtitle=Asymptote,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+% \enabletrackers[sandbox,buffers.run]
+
+%D Currently asymptote assumes \MKII\ but better is to only support \MKIV. A problem
+%D is that asymptote has this hard coded while for \CONTEXT\ it's better to stick to
+%D something simple:
+%D
+%D \starttyping
+%D \starttext
+%D
+%D \startasymptotepage
+%D some label
+%D \stopasymptotepage
+%D
+%D \startasymptotepage
+%D some label
+%D \stopasymptotepage
+%D
+%D \stoptext
+%D \stoptyping
+%D
+%D Which is then run with:
+%D
+%D \starttyping
+%D context --nonstopmode --purge somefile.tex
+%D \stoptyping
+%D
+%D For the moment add "settings.prc=true;" to a graphic that is meant to produce that
+%D format. See end of file for some examples.
+
+\registerctxluafile{m-asymptote}{}
+
+\unprotect
+
+\unexpanded\def\asymptote
+ {\dodoubleempty\module_asymptote}
+
+\unexpanded\def\module_asymptote[#1][#2]%
+ {\iffirstargument
+ \begingroup
+ \getdummyparameters[#2]%
+ \edef\lasttypesetbuffer{\ctxlua{moduledata.asympote.process("asymptote:#1","\dummyparameter\c!type")}}%
+ \externalfigure
+ [\lasttypesetbuffer]%
+ [\c!controls=\lasttypesetbuffer,#2]%
+ \endgroup
+ \fi}
+
+\unexpanded\def\startasymptote[#1]%
+ {\begingroup
+ \dostartbuffer[asymptote:#1][startasymptote][stopasymptote]}
+
+\unexpanded\def\stopasymptote
+ {\endgroup}
+
+\definefittingpage
+ [asymptotepage]
+ [\c!align=\v!normal]
+
+\protect
+
+\continueifinputfile{m-asymptote.mkiv}
+
+\starttext
+
+\startasymptote[demo-1]
+settings.prc=true;
+
+import graph3;
+import palette;
+
+size(6cm,6cm);
+size3(5cm,0);
+
+currentprojection=orthographic(3,-6,12);
+currentlight=light(8,10,2);
+
+real g(pair z) {return 1-z.x^2-z.y^2;}
+real f(pair z) {return -2z.x+2;}
+
+real x(real t) {return t;}
+real y(real t) {return 0;}
+real z(real t) {return 1-t^2;}
+real a(real t) {return 1;}
+real b(real t) {return t;}
+real c(real t) {return -t^2;}
+
+path3 p=graph(x,y,z,-2,2,operator ..);
+path3 o=graph(a,b,c,-2,2,operator ..);
+
+surface r=surface(f,(0,-1),(2,1),nx=3,Spline);
+surface s=surface(g,(-2,-2),(2,2),nx=5,Spline);
+
+path3 q=(-2,-2,-7)--(2,-2,-7)--(2,2,-7)--(-2,2,-7)--cycle;
+
+draw(q);
+
+draw(p,blue+thick(),Arrow3);
+draw(o,blue+thick(),Arrow3);
+
+draw(s,lightgray+opacity(0.8),nolight,meshpen=black+thick());
+draw(r,lightgray+opacity(0.8),nolight,meshpen=black+thick());
+
+draw((1,0,0)--(2,0,-2),black,Arrow3);
+draw((1,0,0)--(1,1,0),black,Arrow3);
+\stopasymptote
+
+\startasymptote[demo-2]
+size(6cm,6cm);
+
+fill((1cm,2cm)--(3cm,3cm)--(4cm,0cm)--cycle);
+\stopasymptote
+
+% see end of grph-inc.mkiv for some more options:
+
+\startluaparameterset[demo-1]
+ toolbar = true,
+ tree = false,
+ view = 'ortho'
+\stopluaparameterset
+
+\asymptote[demo-1][type=prc,width=5cm,height=5cm,frame=on,display=yes,controls=yes,preview=yes]
+\asymptote[demo-2][type=pdf,width=8cm,frame=on]
+
+% \typebuffer[asymptote:demo-1]
+
+% \startasymptotepage
+% test
+% \stopasymptotepage
+
+\stoptext
diff --git a/tex/context/modules/mkiv/m-chart.lua b/tex/context/modules/mkiv/m-chart.lua
index f1e7f4cb9..5a9311387 100644
--- a/tex/context/modules/mkiv/m-chart.lua
+++ b/tex/context/modules/mkiv/m-chart.lua
@@ -10,24 +10,28 @@ if not modules then modules = { } end modules ['x-flow'] = {
-- use metapost.graphic(....) directly
-- todo: labels
+-- todo: named colors
-moduledata.charts = moduledata.charts or { }
+local type, tonumber, rawget, next = type, tonumber, rawget, next
+local gsub, find, lower = string.gsub, string.find, string.lower
+local P, S, C, Cc, lpegmatch = lpeg.P, lpeg.S, lpeg.C, lpeg.Cc, lpeg.match
-local gsub, match, find, format, lower = string.gsub, string.match, string.find, string.format, string.lower
+local formatters = string.formatters
local setmetatableindex = table.setmetatableindex
-local P, S, C, Cc, lpegmatch = lpeg.P, lpeg.S, lpeg.C, lpeg.Cc, lpeg.match
-local report_chart = logs.reporter("chart")
+moduledata.charts = moduledata.charts or { }
+
+local report_chart = logs.reporter("chart")
-local variables = interfaces.variables
+local variables = interfaces.variables
-local v_yes = variables.yes
-local v_no = variables.no
-local v_none = variables.none
-local v_standard = variables.standard
-local v_overlay = variables.overlay
-local v_round = variables.round
-local v_test = variables.test
+local v_yes = variables.yes
+local v_no = variables.no
+local v_none = variables.none
+local v_standard = variables.standard
+local v_overlay = variables.overlay
+local v_round = variables.round
+local v_test = variables.test
local defaults = {
chart = {
@@ -252,8 +256,8 @@ end
function commands.flow_set_text(align,str)
temp.texts[#temp.texts+1] = {
- location = align,
- text = str,
+ align = align,
+ text = str,
}
end
@@ -429,6 +433,7 @@ function commands.flow_set_location(x,y)
if type(x) == "string" and not y then
x, y = lpegmatch(splitter,x)
end
+ local oldx, oldy = x, y
if not x or x == "" then
x = last_x
elseif type(x) == "number" then
@@ -455,6 +460,15 @@ function commands.flow_set_location(x,y)
else
y = tonumber(y)
end
+ if x < 1 or y < 1 then
+ report_chart("the cell (%s,%s) ends up at (%s,%s) and gets relocated to (1,1)",oldx or"?", oldy or "?", x,y)
+ if x < 1 then
+ x = 1
+ end
+ if y < 1 then
+ y = 1
+ end
+ end
temp.x = x or 1
temp.y = y or 1
temp.realx = x or 1
@@ -504,7 +518,7 @@ local function process_cells(chart,xoffset,yoffset)
if shapedata.kind == "line" then
local linesettings = settings.line
context("flow_shape_line_color := \\MPcolor{%s} ;", linesettings.color)
- context("flow_shape_fill_color := \\MPcolor{%s} ;", linesettings.backgroundcolor)
+ context("flow_shape_fill_color := black ;")
context("flow_shape_line_width := %p ; ", linesettings.rulethickness)
elseif focus[cell.focus] or focus[cell.name] then
local focussettings = settings.focus
@@ -567,6 +581,7 @@ local function process_connections(chart,xoffset,yoffset)
local settings = chart.settings
for i=1,#data do
local cell = visible(chart,data[i])
+-- local cell = data[i]
if cell then
local connections = cell.connections
for j=1,#connections do
@@ -576,7 +591,7 @@ local function process_connections(chart,xoffset,yoffset)
if othercell then -- and visible(chart,data[i]) then
local cellx, celly = cell.x, cell.y
local otherx, othery, location = othercell.x, othercell.y, connection.location
- if otherx > 0 and othery > 0 and cellx > 0 and celly > 0 and connection.location then
+ if otherx > 0 and othery > 0 and cellx > 0 and celly > 0 and location then
local what_cell, where_cell, what_other, where_other = lpegmatch(what,location)
if what_cell and where_cell and what_other and where_other then
local linesettings = settings.line
@@ -597,9 +612,17 @@ local function process_connections(chart,xoffset,yoffset)
end
end
-local texttemplate = "\\setvariables[flowcell:text][x=%s,y=%s,text={%s},align={%s},figure={%s},destination={%s}]"
+local f_texttemplate_t = formatters["\\setvariables[flowcell:text][x=%s,y=%s,n=%i,align={%s},figure={%s},overlay={%s},destination={%s}]"]
+local f_texttemplate_l = formatters["\\doFLOWlabel{%i}{%i}{%i}"]
-local splitter = lpeg.splitat(":")
+local splitter = lpeg.splitat(":")
+local charttexts = { } -- permits " etc in mp
+
+function commands.flow_get_text(n)
+ if n > 0 then
+ context(charttexts[n])
+ end
+end
local function process_texts(chart,xoffset,yoffset)
local data = chart.data
@@ -607,41 +630,59 @@ local function process_texts(chart,xoffset,yoffset)
if not data then
return
end
+ charttexts = { }
for i=1,#data do
local cell = visible(chart,data[i])
if cell then
- local x = cell.x or 1
- local y = cell.y or 1
- local texts = cell.texts
- for i=1,#texts do
- local text = texts[i]
- local data = text.text
- local align = validlabellocations[text.align or ""] or text.align or ""
- local figure = i == 1 and cell.figure or ""
- local destination = i == 1 and cell.destination or ""
- context('flow_chart_draw_text(%s,%s,textext("%s")) ;',x,y,format(texttemplate,x,y,data,align,figure,destination))
+ local x = cell.x or 1
+ local y = cell.y or 1
+ local figure = cell.figure or ""
+ local overlay = cell.overlay or ""
+ local destination = cell.destination or ""
+ local texts = cell.texts
+ local noftexts = #texts
+ if noftexts > 0 then
+ for i=1,noftexts do
+ local text = texts[i]
+ local data = text.text
+ local align = text.align or ""
+ local align = validlabellocations[align] or align
+ charttexts[#charttexts+1] = data
+ context('flow_chart_draw_text(%s,%s,textext("%s")) ;',x,y,f_texttemplate_t(x,y,#charttexts,align,figure,overlay,destination))
+ if i == 1 then
+ figure = ""
+ overlay = ""
+ destination = ""
+ end
+ end
+ elseif figure ~= "" or overlay ~= "" or destination ~= "" then
+ context('flow_chart_draw_text(%s,%s,textext("%s")) ;',x,y,f_texttemplate_t(x,y,0,"",figure,overlay,destination))
end
local labels = cell.labels
for i=1,#labels do
- local label = labels[i]
- local text = label.text
- local location = validlabellocations[label.location or ""] or label.location or ""
- if text and location then
- context('flow_chart_draw_label(%s,%s,"%s",textext("\\strut %s")) ;',x,y,location,text)
+ local label = labels[i]
+ local text = label.text
+ local location = label.location or ""
+ local location = validlabellocations[location] or location
+ if text and text ~= "" then
+ charttexts[#charttexts+1] = text
+ context('flow_chart_draw_label(%s,%s,"%s",textext("%s")) ;',x,y,location,f_texttemplate_l(x,y,#charttexts))
end
end
local exits = cell.exits
for i=1,#exits do
- local exit = exits[i]
- local text = exit.text
- local location = validlabellocations[exit.location or ""]
- if text and location then
+ local exit = exits[i]
+ local text = exit.text
+ local location = exit.location or ""
+ local location = validlabellocations[location] or location
+ if text ~= "" then
-- maybe make autoexit an option
if location == "l" and x == chart.from_x + 1 or
location == "r" and x == chart.to_x - 1 or
location == "t" and y == chart.to_y - 1 or
location == "b" and y == chart.from_y + 1 then
- context('flow_chart_draw_exit(%s,%s,"%s",textext("\\strut %s")) ;',x,y,location,text)
+ charttexts[#charttexts+1] = text
+ context('flow_chart_draw_exit(%s,%s,"%s",textext("%s")) ;',x,y,location,f_texttemplate_l(x,y,#charttexts))
end
end
end
@@ -649,10 +690,10 @@ local function process_texts(chart,xoffset,yoffset)
for i=1,#connections do
local comments = connections[i].comments
for j=1,#comments do
- local comment = comments[j]
- local text = comment.text
+ local comment = comments[j]
+ local text = comment.text
local location = comment.location or ""
- local length = 0
+ local length = 0
-- "tl" "tl:*" "tl:0.5"
local loc, len = lpegmatch(splitter,location) -- do the following in lpeg
if len == "*" then
@@ -664,12 +705,13 @@ local function process_texts(chart,xoffset,yoffset)
end
elseif loc then
location = validcommentlocations[loc] or "*"
- length = tonumber(len) or 0
+ length = tonumber(len) or 0
else
location = validcommentlocations[location] or ""
end
- if text and location then
- context('flow_chart_draw_comment(%s,%s,%s,"%s",%s,textext("\\strut %s")) ;',x,y,i,location,length,text)
+ if text and text ~= "" then
+ charttexts[#charttexts+1] = text
+ context('flow_chart_draw_comment(%s,%s,%s,"%s",%s,textext("%s")) ;',x,y,i,location,length,f_texttemplate_l(x,y,#charttexts))
end
end
end
@@ -692,7 +734,6 @@ local function getchart(settings,forced_x,forced_y,forced_nx,forced_ny)
print("no such chart",chartname)
return
end
--- chart = table.copy(chart)
chart = expanded(chart,settings)
local chartsettings = chart.settings.chart
local autofocus = chart.settings.chart.autofocus
@@ -721,6 +762,14 @@ local function getchart(settings,forced_x,forced_y,forced_nx,forced_ny)
if miny == 0 or y > maxy then maxy = y end
end
end
+-- optional:
+if x + nx > maxx then
+ nx = maxx - x + 1
+end
+if y + ny > maxy then
+ ny = maxy - y + 1
+end
+ --
-- print("1>",x,y,nx,ny)
-- print("2>",minx, miny, maxx, maxy)
-- check of window should be larger (maybe autofocus + nx/ny?)
@@ -837,6 +886,9 @@ local function makechart(chart)
context("flow_chart_offset := %p ;",offset)
--
context("flow_reverse_y := true ;")
+ if chartsettings.option == v_test then
+ context("flow_draw_test_shapes ;")
+ end
process_cells(chart,0,0)
process_connections(chart,0,0)
process_texts(chart,0,0)
@@ -875,9 +927,9 @@ local function splitchart(chart)
if done then
last_x = to_x
end
--- if first_x >= to_x then
--- break
--- end
+ -- if first_x >= to_x then
+ -- break
+ -- end
local part_y = 0
local first_y = from_y
while true do
@@ -887,31 +939,31 @@ local function splitchart(chart)
if done then
last_y = to_y
end
--- if first_y >= to_y then
--- break
--- end
+ -- if first_y >= to_y then
+ -- break
+ -- end
--
-local data = chart.data
-for i=1,#data do
- local cell = data[i]
--- inspect(cell)
- local cx, cy = cell.x, cell.y
- if cx >= first_x and cx <= last_x then
- if cy >= first_y and cy <= last_y then
- report_chart("part (%s,%s) of %a is split from (%s,%s) -> (%s,%s)",part_x,part_y,name,first_x,first_y,last_x,last_y)
- local x = first_x
- local y = first_y
- local nx = last_x - first_x + 1
- local ny = last_y - first_y + 1
- context.beforeFLOWsplit()
- context.handleFLOWsplit(function()
- makechart(getchart(settings,x,y,nx,ny)) -- we need to pass frozen settings !
- end)
- context.afterFLOWsplit()
- break
- end
- end
-end
+ local data = chart.data
+ for i=1,#data do
+ local cell = data[i]
+ -- inspect(cell)
+ local cx, cy = cell.x, cell.y
+ if cx >= first_x and cx <= last_x then
+ if cy >= first_y and cy <= last_y then
+ report_chart("part (%s,%s) of %a is split from (%s,%s) -> (%s,%s)",part_x,part_y,name,first_x,first_y,last_x,last_y)
+ local x = first_x
+ local y = first_y
+ local nx = last_x - first_x + 1
+ local ny = last_y - first_y + 1
+ context.beforeFLOWsplit()
+ context.handleFLOWsplit(function()
+ makechart(getchart(settings,x,y,nx,ny)) -- we need to pass frozen settings !
+ end)
+ context.afterFLOWsplit()
+ break
+ end
+ end
+ end
--
if done then
break
diff --git a/tex/context/modules/mkiv/m-chart.mkvi b/tex/context/modules/mkiv/m-chart.mkvi
index a0c8b2244..69d90f47b 100644
--- a/tex/context/modules/mkiv/m-chart.mkvi
+++ b/tex/context/modules/mkiv/m-chart.mkvi
@@ -15,7 +15,6 @@
% flowsets
% autoscaling (bodyfontsteps)
% comment
-% overlay
%
% todo:
% \useFLOWchart[name][parent][setting,setting][additional settings]
@@ -63,8 +62,6 @@
\c!commentoffset=.5\bodyfontsize,
\c!exitoffset=\zeropoint,
% \c!split=\v!no,
- % \c!maxwidth=,
- % \c!maxheight=,
% \c!option=,
% \c!bodyfont=,
% \c!dot=, % private option
@@ -256,11 +253,11 @@
\unexpanded\def\FLOWcharts
{\dodoubleempty\FLOW_charts}
-\def\FLOW_charts[#name][#settings]
+\def\FLOW_charts[#name][#settings]%
{\begingroup
\setupFLOWchart[\c!split=\v!yes]%
\setupFLOWsplit[#settings]%
- \module_charts_process[#name][]% \FLOWchart...
+ \FLOWchart[#name]%
\endgroup}
\appendtoks
@@ -307,7 +304,7 @@
\unexpanded\def\module_charts_FLOW_include [#name][#settings]{%
\begingroup
- \getparameters[FLOWi][x=1,y=1,#settings]%
+ \getparameters[FLOWi][\c!x=1,\c!y=1,#settings]%
\ctxcommand{flow_set_include("#name",\number\FLOWix,\number\FLOWiy,\!!bs\detokenize{#settings}\!!es)}%
\endgroup
\ignorespaces
@@ -315,7 +312,8 @@
\setvariables
[flowcell:text]
- [x=1,
+ [n=0,
+ x=1,
y=1,
text=,
align=,
@@ -324,8 +322,6 @@
\def\FLOWx{\getvariable{flowcell:text}{x}} % compatibility (for Willi)
\def\FLOWy{\getvariable{flowcell:text}{y}} % compatibility (for Willi)
-% \c!background={\@@FLOWbackground,\FLOWoverlay},
-
\defineoverlay
[flowcell:figure]
[\overlayfigure{\getvariable{flowcell:text}{figure}}]
@@ -335,13 +331,15 @@
\iftrialtypesetting
\directsetup{flowcell:text:place:indeed}
\else \iflocation
- \doifelsenothing {\getvariable{flowcell:text}{destination}} {
+ \edef\flowcelldestination{\getvariable{flowcell:text}{destination}}%
+ \ifx\flowcelldestination\empty
\directsetup{flowcell:text:place:indeed}
- } {
+ \else
% tricky: scaling and moving around is not taken into account
- \setupinteraction[\c!color=,\c!contrastcolor=]
- \gotobox{\directsetup{flowcell:text:place:indeed}}[\getvariable{flowcell:text}{destination}]
- }
+ \letinteractionparameter\c!color\empty
+ \letinteractionparameter\c!contrastcolor\empty
+ \gotobox{\directsetup{flowcell:text:place:indeed}}[\flowcelldestination]
+ \fi
\else
\directsetup{flowcell:text:place:indeed}
\fi \fi
@@ -351,17 +349,41 @@
\startsetups flowcell:text:place:indeed
\begingroup
\directsetup{flowcell:text:user}
- \doifelsenothing {\getvariable{flowcell:text}{figure}} {
- \expandcheckedcsname{flowcell:}{\getvariable{flowcell:text}{align}}\empty
- {\getvariable{flowcell:text}{text}}
- } {
- \expandcheckedcsname{flowcell:}{\getvariable{flowcell:text}{align}}\empty
- [\c!background=flowcell:figure]
- {\getvariable{flowcell:text}{text}}
- }
+ \edef\flowcellfigure {\getvariable{flowcell:text}{figure}}%
+ \edef\flowcelloverlay{\getvariable{flowcell:text}{overlay}}%
+ \edef\flowcellalign {\getvariable{flowcell:text}{align}}%
+ \edef\flowcellindex {\getvariable{flowcell:text}{n}}%
+ \ifx\flowcellfigure\empty
+ \ifx\flowcelloverlay\empty
+ \expandcheckedcsname{flowcell:}\flowcellalign\empty
+ % {\getvariable{flowcell:text}{text}}
+ {\getFLOWtext\flowcellindex}
+ \else
+ \expandcheckedcsname{flowcell:}\flowcellalign\empty
+ [\c!background={\flowcelloverlay}]
+ % {\getvariable{flowcell:text}{text}}
+ {\getFLOWtext\flowcellindex}
+ \fi
+ \else
+ \expandcheckedcsname{flowcell:}\flowcellalign\empty
+ [\c!background=flowcell:figure]
+ % {\getvariable{flowcell:text}{text}}
+ {\getFLOWtext\flowcellindex}
+ \fi
\endgroup
\stopsetups
+\unexpanded\def\doFLOWlabel#1#2#3%
+ {\begingroup
+ \def\FLOWx{#1}%
+ \def\FLOWy{#2}%
+ \strut
+ \getFLOWtext{#3}%
+ \endgroup}
+
+\unexpanded\def\getFLOWtext#1%
+ {\ifcase#1\else\ctxcommand{flow_get_text(#1)}\fi}
+
\defineframed % to be discussed: shape or global
[flowcell:base]
[\c!offset=\v!overlay, % no strut ?
diff --git a/tex/context/modules/mkiv/m-educat.mkiv b/tex/context/modules/mkiv/m-educat.mkiv
index 93b1a6c5d..e39738e99 100644
--- a/tex/context/modules/mkiv/m-educat.mkiv
+++ b/tex/context/modules/mkiv/m-educat.mkiv
@@ -47,7 +47,8 @@
{\begingroup
\dontcomplain
\setupanswerarea
- [\c!n=0,\c!m=,#1,\c!location=\v!text]%
+ [\c!n=0,\c!m=#1,\c!location=\v!text]%
+ \let\currenttextbackground\v!answerarea
\doifelsenothing{\textbackgroundparameter\c!m}
{\expandafter\donoanswerspace}
{\expandafter\dodoanswerspace}%
@@ -110,6 +111,7 @@
\dontcomplain
\setupanswerarea
[\c!n=0,\c!m=,#1,\c!location=\v!text]%
+ \let\currenttextbackground\v!answerarea
\doifnot{\textbackgroundparameter\c!option}\v!joinedup\softbreak
\doifelsenothing{\textbackgroundparameter\c!m}
{\expandafter\donostartanswerlines}
@@ -156,8 +158,10 @@
#2%
\getvalue{\e!stop\e!answerlines}}
-\protect \doifnotmode{demo}{\endinput}
-
+\protect
+
+\continueifinputfile{m-educat.mkiv}
+
%D Test materiaal.
\starttext
diff --git a/tex/context/modules/mkiv/m-graph.mkiv b/tex/context/modules/mkiv/m-graph.mkiv
index 62c4ec4cb..8946732d0 100644
--- a/tex/context/modules/mkiv/m-graph.mkiv
+++ b/tex/context/modules/mkiv/m-graph.mkiv
@@ -25,7 +25,8 @@
\c!method=\s!double]
\startMPdefinitions{graph}
- if unknown context_grap : input mp-grap.mpiv ; fi ;
+ loadmodule "grap" ;
+% input mp-grap.mpiv ;
\stopMPdefinitions
\protect
@@ -71,8 +72,6 @@
label.rt(formatted("(@j,@j)",(1.23,4.56)),(0cm,-5.0cm)) ;
\stopMPpage
-\stoptext
-
% \startMPpage[instance=graph]
% draw begingraph(3in,2in);
% gdraw "t:/metapost/grphdata/agepop91.d";
@@ -131,3 +130,5 @@
% autogrid(otick.bot,otick.rt);
% endgraph;
% \stopMPpage
+
+\stoptext
diff --git a/tex/context/modules/mkiv/m-ipsum.mkiv b/tex/context/modules/mkiv/m-ipsum.mkiv
index 1c5901d86..7ba78ee2e 100644
--- a/tex/context/modules/mkiv/m-ipsum.mkiv
+++ b/tex/context/modules/mkiv/m-ipsum.mkiv
@@ -127,6 +127,7 @@ end
\startsetups[handler:action:ipsum]
\useipsumstyleandcolor\c!style\c!color
+ % hm, also changes dates
\uselanguageparameter\ipsumparameter
\ctxlua{moduledata.ipsum.typeset {
alternative = "\ipsumparameter\c!alternative",
diff --git a/tex/context/modules/mkiv/m-matrix.mkiv b/tex/context/modules/mkiv/m-matrix.mkiv
index ccb376e39..f59363e94 100644
--- a/tex/context/modules/mkiv/m-matrix.mkiv
+++ b/tex/context/modules/mkiv/m-matrix.mkiv
@@ -28,6 +28,9 @@ local formatters = string.formatters
local copy = table.copy
local insert = table.insert
local remove = table.remove
+local random = math.random
+
+local context = context
local matrix = { }
moduledata.matrix = matrix
@@ -67,35 +70,120 @@ end
-- todo: define a matrix at the tex end so that we have more control
-local fences_p = {
- left = "\\left(\\,",
- right = "\\,\\right)",
+local fences = {
+ parentheses = { left = "\\left(\\,", right = "\\,\\right)" },
+ brackets = { left = "\\left[\\,", right = "\\,\\right]" },
+ bars = { left = "\\left|\\,", right = "\\,\\right|" },
}
-local fences_b = {
- left = "\\left[\\,",
- right = "\\,\\right]",
-}
+-- one can add more fences
+
+fences.bar = fences.bars
+fences.parenthesis = fences.parentheses
+fences.bracket = fences.brackets
+
+-- one can set the template
+
+matrix.template = "%0.3F"
function matrix.typeset(m,options)
- local options = settings_to_hash(options or "")
- context.startmatrix(options.determinant and fences_b or fences_p)
- for i=1, #m do
- local mi = m[i]
- for j=1,#mi do
- context.NC(mi[j])
- end
- context.NR()
+ if type(m) == "table" then
+ local options = settings_to_hash(options or "")
+ local whatever = options.determinant == "yes" and fences.bars or fences.parentheses
+ if options.fences then
+ whatever = fences[options.fences] or whatever
+ elseif options.determinant then
+ -- whatever = fences.brackets
+ whatever = fences.bars
end
- context.stopmatrix()
+ local template = options.template or matrix.template
+ if template == "yes" then
+ template = matrix.template
+ elseif template == "no" then
+ template = false
+ elseif tonumber(template) then
+ template = "%0." .. template .. "F"
+ end
+ context.startmatrix(whatever)
+ for i=1, #m do
+ local mi = m[i]
+ for j=1,#mi do
+ context.NC()
+ local n = mi[j]
+ if template and tonumber(n) then
+ context(template,n)
+ else
+ context(mi[j])
+ end
+ end
+ context.NR()
+ end
+ context.stopmatrix()
+ elseif m then
+ context(m)
+ end
end
-- interchange two rows (i-th, j-th)
-function matrix.swap(t,i,j)
- t[i], t[j] = t[j], t[i]
+-- function matrix.swaprows(t,i,j)
+-- if i <= #t and j <= #t then
+-- t[i], t[j] = t[j], t[i]
+-- return t
+-- else
+-- return "error: out of bound"
+-- end
+-- end
+
+function matrix.swaprows(t,i,j)
+ local ti = t[i]
+ if not ti then
+ return "error: no row i"
+ end
+ local tj = t[j]
+ if not tj then
+ return "error: no row j"
+ end
+ t[i], t[j] = tj, ti
+ return t
+end
+
+-- interchange two columns (i-th, j-th)
+
+-- function matrix.swapcolumns(t, i, j)
+-- if i <= #t[1] and j <= #t[1] then
+-- for k = 1, #t do
+-- t[k][i], t[k][j] = t[k][j], t[k][i]
+-- end
+-- return t
+-- else
+-- return "error: out of bound"
+-- end
+-- end
+
+function matrix.swapcolumns(t, i, j)
+ local t1 = t[1]
+ if not t1 then
+ return "error: no rows"
+ end
+ local n = #t1
+ if i <= n then
+ return "error: no row i"
+ end
+ if j <= n then
+ return "error: no row j"
+ end
+ for k = 1, #t do
+ local tk = t[k]
+ tk[i], tk[j] = tk[j], tk[i]
+ end
+ return t
end
+matrix.swapC = matrix.swapcolumns
+matrix.swapR = matrix.swaprows
+matrix.swap = matrix.swaprows
+
-- replace i-th row with factor * (i-th row)
function matrix.multiply(m,i,factor)
@@ -151,7 +239,7 @@ function matrix.inner(u,v)
end
local nv = #v
if nv ~= nu then
- return 0
+ return "error: size mismatch"
end
local result = 0
for i=1,nu do
@@ -163,8 +251,8 @@ end
-- product of two matrices
function matrix.product(m1,m2)
- local product = { }
if #m1[1] == #m2 then
+ local product = { }
for i=1,#m1 do
local m1i = m1[i]
local mrow = { }
@@ -177,8 +265,10 @@ function matrix.product(m1,m2)
end
product[i] = mrow
end
+ return product
+ else
+ return "error: size mismatch"
end
- return product
end
local function uppertri(m,sign)
@@ -216,7 +306,7 @@ end
matrix.uppertri = uppertri
-function matrix.determinant(m)
+local function determinant(m)
if #m == #m[1] then
local d = 1
local t, s = uppertri(m,1)
@@ -225,10 +315,12 @@ function matrix.determinant(m)
end
return s*d
else
- return 0
+ return "error: not a square matrix"
end
end
+matrix.determinant = determinant
+
local function rowechelon(m,r)
local temp = copy(m)
local pRow = 1
@@ -293,9 +385,102 @@ end
matrix.rowechelon = rowechelon
matrix.rowEchelon = rowechelon
+-- make matrices until its determinant is not 0
+
+function matrix.make(n,m,low,high)
+ if not n then
+ n = 10
+ end
+ if not m then
+ m = 10
+ end
+ if not low then
+ low = 0
+ end
+ if not high then
+ high = 100
+ end
+ local t = { } -- make an empty n1 x n2 array
+ local again = true
+ for i=1,n do
+ t[i] = { }
+ end
+ while true do
+ for i=1,n do
+ local ti = t[i]
+ for j=1,m do
+ ti[j] = random(low,high)
+ end
+ end
+ if n ~= m or determinant(t,1) ~= 0 then
+ return t
+ end
+ end
+end
+
+-- extract submatrix by using
+
+local function submatrix(t,i,j)
+ local rows = #t
+ local columns = #t[1]
+ local sign = 1 -- not used
+ if i <= rows and j <= columns then
+ local c = copy(t)
+ remove(c,i)
+ for k=1,rows-1 do
+ remove(c[k],j)
+ end
+ return c
+ else
+ return "error: out of bound"
+ end
+end
+
+matrix.submatrix = submatrix
+
+-- calculating determinant using Laplace Expansion
+
+function matrix.laplace(t) -- not sure if this is the most effient but
+ local factors = { 1 } -- it's not used for number crunching anyway
+ local data = copy(t)
+ local det = 0
+ while #data > 0 do
+ local mat = { }
+ local siz = #data[1]
+ if siz == 0 then
+ return "error: no determinant"
+ elseif siz == 1 then
+ det = data[1][1]
+ return det
+ end
+ for i=1,siz do
+ mat[i] = data[1]
+ remove(data,1)
+ end
+ local factor = remove(factors,1)
+ local m1 = mat[1]
+ if siz == 2 then
+ local m2 = mat[2]
+ det = det + factor * (m1[1]*m2[2] - m1[2]*m2[1])
+ else
+ for j=1,#m1 do
+ local m1j = m1[j]
+ if m1j ~= 0 then
+ insert(factors, (-1)^(j+1) * factor * m1j)
+ local m = submatrix(mat,1,j)
+ for k, v in next, m do
+ insert(data,v)
+ end
+ end
+ end
+ end
+ end
+ return det
+end
+
-- solve the linear equation m X = c
-local function solve(m,c)
+local function solve(m,c)
local n = #m
if n ~= #c then
return copy(m)
@@ -393,14 +578,14 @@ moduledata.matrix.typeset(moduledata.matrix.multiply(document.DemoMatrixA, 2, 3)
\stopsubject
-\startsubject[title={Row 2 + $3 \times r_4$}]
+\startsubject[title={Row 2 + $4 \times r_3$}]
\startluacode
moduledata.matrix.typeset(document.DemoMatrixA)
context.blank()
moduledata.matrix.sumrow(document.DemoMatrixA, 2, 3, 4)
context.blank()
-moduledata.matrix.typeset(document.DemoMatrixA)
+moduledata.matrix.typeset(document.DemoMatrixA,{ fences = "bars" } )
\stopluacode
\stopsubject
@@ -445,7 +630,7 @@ local m = {
{ 0, 0, 2 },
{ 2, 2, -6 },
}
-context(moduledata.matrix.determinant(m))
+context(moduledata.matrix.determinant(m, "determinant=yes" ))
\stopluacode
\stopsubject
@@ -461,7 +646,8 @@ local m = {
}
moduledata.matrix.typeset(m)
-moduledata.matrix.typeset(moduledata.matrix.rowechelon(m,1))
+context.blank()
+moduledata.matrix.typeset(moduledata.matrix.rowechelon(m,1), { determinant = "yes" })
\stopluacode
\stopsubject
@@ -479,6 +665,14 @@ local m = {
local c = { 5, 2, 6, 8 }
moduledata.matrix.typeset(moduledata.matrix.solve(m,c))
+context.blank()
+moduledata.matrix.typeset(moduledata.matrix.solve(m,c), { template = 6 })
+context.blank()
+moduledata.matrix.typeset(moduledata.matrix.solve(m,c), { template = "no" })
+context.blank()
+moduledata.matrix.typeset(moduledata.matrix.solve(m,c), { template = "%0.3f" })
+context.blank()
+moduledata.matrix.typeset(moduledata.matrix.solve(m,c), { template = "%0.4F" })
\stopluacode
\stopsubject
diff --git a/tex/context/modules/mkiv/m-punk.mkiv b/tex/context/modules/mkiv/m-punk.mkiv
index 331e90d2e..f7e17da83 100644
--- a/tex/context/modules/mkiv/m-punk.mkiv
+++ b/tex/context/modules/mkiv/m-punk.mkiv
@@ -11,11 +11,6 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-\ifx\luaversion\undefined \endinput \fi
-
-% At some point the font generation code will move into the
-% ConTeXt MkIV kernel.
-
\startluacode
local concat = table.concat
local chardata = characters.data
@@ -242,7 +237,7 @@ end)
\definetypeface [punk] [rm] [serif] [punk] [default]
\stoptypescript
-\endinput
+\continueifinputfile{m-punk.mkiv}
\usetypescript[punk]
diff --git a/tex/context/modules/mkiv/m-scite.mkiv b/tex/context/modules/mkiv/m-scite.mkiv
index fd4a3c7a1..a7d9f8b5c 100644
--- a/tex/context/modules/mkiv/m-scite.mkiv
+++ b/tex/context/modules/mkiv/m-scite.mkiv
@@ -56,11 +56,11 @@ buffers.scite = scite
-- context output:
-local f_def_color = formatters["\\definecolor[slxc%s][h=%s%s%s]%%"]
-local f_fore_none = formatters["\\def\\slx%s#1{{\\slxc%s#1}}%%"]
-local f_fore_bold = formatters["\\def\\slx%s#1{{\\slxc%s\\bf#1}}%%"]
-local f_none_bold = formatters["\\def\\slx%s#1{{\\bf#1}}%%"]
-local f_none_none = formatters["\\def\\slx%s#1{{#1}}%%"]
+local f_def_color = formatters["\\definecolor[slxc%s][h=%02X%02X%02X]%%"]
+local f_fore_none = formatters["\\unexpanded\\def\\slx%s#1{{\\slxc%s#1}}%%"]
+local f_fore_bold = formatters["\\unexpanded\\def\\slx%s#1{{\\slxc%s\\bf#1}}%%"]
+local f_none_bold = formatters["\\unexpanded\\def\\slx%s#1{{\\bf#1}}%%"]
+local f_none_none = formatters["\\unexpanded\\def\\slx%s#1{{#1}}%%"]
local f_texstyled = formatters["\\slx%s{%s}"]
local f_hanging = formatters["\\slxb{%s}%s\\slxe"]
@@ -90,7 +90,7 @@ local replacer = lpeg.replacer {
["\\"] = "\\slxB ",
["%"] = "\\slxP ",
["~"] = "\\slxT ",
- [" "] = "\\slxS ",
+ [" "] = "\\slxS ", -- can be made more efficient: \\slxF{n}
}
local colors = nil
@@ -99,14 +99,14 @@ local function exportcolors()
if not colors then
scite.loadscitelexer()
local function black(f)
- return (f[1] == f[2]) and (f[2] == f[3]) and (f[3] == '00')
+ return (f[1] == f[2]) and (f[2] == f[3]) and (f[3] == 0)
end
local result, r = { f_mapping }, 1
for k, v in table.sortedhash(lexer.context.styles) do
local fore = v.fore
if fore and not black(fore) then
r = r + 1
- result[r] = f_def_color(k,fore[1],fore[2],fore[3])
+ result[r] = f_def_color(k,fore[1],fore[2] or fore[1],fore[3] or fore[1])
end
end
r = r + 1
@@ -169,6 +169,10 @@ end
local p1 = lpeg.tsplitat(lpeg.patterns.newline)
local p2 = lpeg.P("\\slxS ")^1
+local p3 = lpeg.Cs((lpeg.Cp() * lpeg.P(" ") * lpeg.Cp() / function(b,e) return "\\slxF{" .. (e-b-1) .. "}" end
+ + (1-lpeg.P(" "))^1)^0)
+
+-- slxb could have a \hskip so then we can replace the slxS's
local function indent(str)
local l = lpegmatch(p1,str)
@@ -181,7 +185,10 @@ local function indent(str)
else
n = 0
end
- l[i] = f_hanging(n,s)
+s = lpegmatch(p3,s) -- can be combined
+ l[i] = f_hanging(n,s) -- "\\slxb{%s}%s\\slxe "
+-- print(">",s)
+-- print("<",l[i])
end
end
return concat(l,"\n")
@@ -211,10 +218,12 @@ end
\unprotect
+\newdimen\scitespaceskip
+
\unexpanded\def\buff_scite_slxb#1%
{%\begingroup
- \hangindent\dimexpr\numexpr#1+1\relax\emwidth\relax
- \hangafter \numexpr\numexpr#1+1\relax}
+ \hangindent\numexpr#1+2\relax\scitespaceskip
+ \hangafter 1\relax}
\unexpanded\def\buff_scite_slxe
{\par
@@ -223,7 +232,9 @@ end
\unexpanded\def\installscitecommands
{\ctxlua{buffers.scite.installcommands()}%
\let\installscitecommands\relax
- \def\slxS{\fixedspace\allowbreak}%
+ \scitespaceskip\fontcharwd\font`0\relax
+ \unexpanded\def\slxS{\hskip\scitespaceskip}%
+ \unexpanded\def\slxF##1{\hskip##1\scitespaceskip\relax}%
\let\slxb\buff_scite_slxb
\let\slxe\buff_scite_slxe}
@@ -251,7 +262,7 @@ end
\raggedright
\startcontextcode
\startlines
- \getbuffer[lex]%
+ \getbuffer[lex]
\stoplines
\stopcontextcode
\stop}
diff --git a/tex/context/modules/mkiv/m-steps.lua b/tex/context/modules/mkiv/m-steps.lua
index 8eb481550..ce84866a4 100644
--- a/tex/context/modules/mkiv/m-steps.lua
+++ b/tex/context/modules/mkiv/m-steps.lua
@@ -8,11 +8,20 @@ if not modules then modules = { } end modules ['x-flow'] = {
-- when we can resolve mpcolor at the lua end we will use metapost.graphic(....) directly
+local tonumber = tonumber
+
moduledata.steps = moduledata.steps or { }
-local variables = interfaces.variables
+local context = context
+local variables = interfaces.variables
+local formatters = string.formatters
+----- mpcolor = attributes.colors.mpnamedcolor
+local concat = table.concat
+
+local report = logs.reporter("stepcharts")
+local trace = false
-local trace_charts = false
+trackers.register("stepcharts",function(v) trace = v end)
local defaults = {
chart = {
@@ -48,179 +57,494 @@ local defaults = {
-- maybe: includes
-- maybe: flush ranges
-local charts = { }
+local charts = { } -- not used but we could support nesting
+local chart = nil
local steps = { }
+local count = 0
-function commands.step_start_chart(name)
+local function step_start_chart(name,alternative)
name = name or ""
- steps = { }
- charts[name] = {
- steps = steps,
+ steps = table.setmetatableindex(function(t,k)
+ local v = { -- could be metatable
+ cell_top = false,
+ cell_bot = false,
+ text_top = false,
+ text_mid = false,
+ text_bot = false,
+ start_t = k,
+ start_m = k,
+ start_b = k,
+ cell_ali = false,
+ }
+ t[k] = v
+ return v
+ end)
+ count = 0
+ chart = {
+ steps = steps,
+ count = count,
+ alternative = alternative,
}
+ charts[name] = chart
end
-function commands.step_stop_chart()
+local function step_stop_chart()
+ chart.count = count
end
-function commands.step_make_chart(settings)
+local function step_make_chart(settings)
local chartsettings = settings.chart
if not chartsettings then
- print("no chart")
+ if trace then
+ report("no chart")
+ end
return
end
local chartname = chartsettings.name
if not chartname then
- print("no name given")
+ if trace then
+ report("no name given")
+ end
return
end
local chart = charts[chartname]
if not chart then
- print("no such chart",chartname)
+ if trace then
+ report("no such chart: %s",chartname)
+ end
return
end
local steps = chart.steps or { }
--
table.setmetatableindex(settings,defaults)
--
- if trace_charts then
- inspect(steps)
+ if trace then
+ report(table.serialize(steps,"chartdata"))
end
--
local textsettings = settings.text
local cellsettings = settings.cell
local linesettings = settings.line
+
+ local start = nil
+ local stop = nil
+ local flush = nil
+
+ if false then
+
+ -- some 2% faster at most, so neglectable as this kind of graphics
+ -- is hardly used in quantity but it saves mem and tokens in tracing
+ -- and we lose some aspects, like outer color and so (currently)
+
+ local mpcode = false
+
+ start = function()
+ mpcode = { }
+ end
+ stop = function()
+ local code = concat(mpcode,"\n")
+ -- print(code)
+ metapost.graphic {
+ -- instance = "metafun",
+ instance = "steps",
+ format = "metafun",
+ data = code,
+ -- initializations = "",
+ -- extensions = "",
+ -- inclusions = "",
+ definitions = 'loadmodule "step" ;',
+ -- figure = "",
+ method = "double",
+ }
+ mpcode = false
+ end
+ flush = function(fmt,first,...)
+ if first then
+ mpcode[#mpcode+1] = formatters[fmt](first,...)
+ else
+ mpcode[#mpcode+1] = fmt
+ end
+ end
+
+ else
+
+ start = function() context.startMPcode("steps") end
+ stop = context.stopMPcode
+ flush = context
+
+ end
+ --
+ start()
+ flush("step_begin_chart ;")
+ --
+ local alternative = chartsettings.alternative
+ if not alternative or alternative == "" then
+ alternative = chart.alternative
+ end
+ if not alternative or alternative == "" then
+ alternative = variables.horizontal
+ end
+ local alternative = utilities.parsers.settings_to_hash(alternative)
+ local vertical = alternative[variables.vertical]
+ local align = alternative[variables.three]
+ local category = chartsettings.category
--
- context.startMPcode()
- context("if unknown context_cell : input mp-step.mpiv ; fi ;")
- context("step_begin_chart ;")
+ flush('chart_category := "%s" ;',category)
--
- if chartsettings.alternative == variables.vertical then
- context("chart_vertical := true ;")
+ if vertical then
+ flush("chart_vertical := true ;")
+ end
+ if align then
+ flush("chart_align := true ;")
end
--
- context("text_line_color := \\MPcolor{%s} ;", textsettings.framecolor)
- context("text_line_width := %p ;", textsettings.rulethickness)
- context("text_fill_color := \\MPcolor{%s} ;", textsettings.backgroundcolor)
- context("text_offset := %p ;", textsettings.offset)
- context("text_distance_set := %p ;", textsettings.distance)
+ flush("text_line_color := %q ;", textsettings.framecolor)
+ flush("text_line_width := %p ;", textsettings.rulethickness)
+ flush("text_fill_color := %q ;", textsettings.backgroundcolor)
+ flush("text_offset := %p ;", textsettings.offset)
+ flush("text_distance_set := %p ;", textsettings.distance)
--
- context("cell_line_color := \\MPcolor{%s} ;", cellsettings.framecolor)
- context("cell_line_width := %p ;", cellsettings.rulethickness)
- context("cell_fill_color := \\MPcolor{%s} ;", cellsettings.backgroundcolor)
- context("cell_offset := %p ;", cellsettings.offset)
- context("cell_distance_x := %p ;", cellsettings.dx)
- context("cell_distance_y := %p ;", cellsettings.dy)
+ flush("cell_line_color := %q ;", cellsettings.framecolor)
+ flush("cell_line_width := %p ;", cellsettings.rulethickness)
+ flush("cell_fill_color := %q ;", cellsettings.backgroundcolor)
+ flush("cell_offset := %p ;", cellsettings.offset)
+ flush("cell_distance_x := %p ;", cellsettings.dx)
+ flush("cell_distance_y := %p ;", cellsettings.dy)
--
- context("line_line_color := \\MPcolor{%s} ;", linesettings.color)
- context("line_line_width := %p ;", linesettings.rulethickness)
- context("line_distance := %p ;", linesettings.distance)
- context("line_offset := %p ;", linesettings.offset)
+ flush("line_line_color := %q ;", linesettings.color)
+ flush("line_line_width := %p ;", linesettings.rulethickness)
+ flush("line_distance := %p ;", linesettings.distance)
+ flush("line_offset := %p ;", linesettings.offset)
+ flush("line_height := %p ;", linesettings.height)
--
- for i=1,#steps do
+ for i=1,chart.count do
local step = steps[i]
- context("step_begin_cell ;")
- if step.cell_top ~= "" then
- context('step_cell_top("%s") ;',string.strip(step.cell_top))
+ flush("step_begin_cell ;")
+ local ali = step.cell_ali
+ local top = step.cell_top
+ local bot = step.cell_bot
+ if ali then
+ local text = ali.text
+ local shape = ali.shape
+ flush('step_cell_ali(%s,%s,%s,%q,%q,%p,%i) ;',
+ tonumber(text.left) or 0,
+ tonumber(text.middle) or 0,
+ tonumber(text.right) or 0,
+ shape.framecolor,
+ shape.backgroundcolor,
+ shape.rulethickness,
+ tonumber(shape.alternative) or 24
+ )
end
- if step.cell_bot ~= "" then
- context('step_cell_bot("%s") ;',string.strip(step.cell_bot))
+ if top then
+ local shape = top.shape
+ flush('step_cell_top(%s,%q,%q,%p,%i) ;',
+ tonumber(top.text.top) or 0,
+ shape.framecolor,
+ shape.backgroundcolor,
+ shape.rulethickness,
+ tonumber(shape.alternative) or 24
+ )
end
- if step.text_top ~= "" then
- context('step_text_top("%s") ;',string.strip(step.text_top))
+ if bot then
+ local shape = bot.shape
+ flush('step_cell_bot(%s,%q,%q,%p,%i) ;',
+ tonumber(bot.text.bot) or 0,
+ shape.framecolor,
+ shape.backgroundcolor,
+ shape.rulethickness,
+ tonumber(shape.alternative) or 24
+ )
end
- if step.text_mid ~= "" then
- context('step_text_mid("%s") ;',string.strip(step.text_mid))
+ local top = step.text_top
+ local mid = step.text_mid
+ local bot = step.text_bot
+ local s_t = step.start_t
+ local s_m = step.start_m
+ local s_b = step.start_b
+ if top then
+ local shape = top.shape
+ local line = top.line
+ flush('step_text_top(%s,%q,%q,%p,%i,%q,%p,%i) ;',
+ tonumber(top.text.top) or 0,
+ shape.framecolor,
+ shape.backgroundcolor,
+ shape.rulethickness,
+ tonumber(shape.alternative) or 24,
+ line.color,
+ line.rulethickness,
+ tonumber(line.alternative) or 1
+ )
end
- if step.text_bot ~= "" then
- context('step_text_bot("%s") ;',string.strip(step.text_bot))
+ if mid then -- used ?
+ local shape = mid.shape
+ local line = mid.line
+ flush('step_text_mid(%s,%q,%q,%p,%i,%q,%p,%i) ;',
+ tonumber(mid.text.mid) or 0,
+ shape.framecolor,
+ shape.backgroundcolor,
+ shape.rulethickness,
+ tonumber(shape.alternative) or 24,
+ line.color,
+ line.rulethickness,
+ tonumber(line.alternative) or 1
+ )
end
- context("step_end_cell ;")
+ if bot then
+ local shape = bot.shape
+ local line = bot.line
+ flush('step_text_bot(%s,%q,%q,%p,%i,%q,%p,%i) ;',
+ tonumber(bot.text.bot) or 0,
+ shape.framecolor,
+ shape.backgroundcolor,
+ shape.rulethickness,
+ tonumber(shape.alternative) or 24,
+ line.color,
+ line.rulethickness,
+ tonumber(line.alternative) or 1
+ )
+ end
+ flush('start_t[%i] := %i ;',i,s_t)
+ flush('start_m[%i] := %i ;',i,s_m)
+ flush('start_b[%i] := %i ;',i,s_b)
+ flush("step_end_cell ;")
end
--
- context("step_end_chart ;")
- context.stopMPcode()
+ flush("step_end_chart ;")
+ stop()
end
-function commands.step_cells(top,bot)
- steps[#steps+1] = {
- cell_top = top or "",
- cell_bot = bot or "",
- text_top = "",
- text_mid = "",
- text_bot = "",
- }
+local function step_cells(spec)
+ count = count + 1
+ local step = steps[count]
+ step.cell_top = spec
+ step.cell_bot = spec
end
-function commands.step_texts(top,bot)
- if #steps > 0 then
- steps[#steps].text_top = top or ""
- steps[#steps].text_bot = bot or ""
- end
+local function step_cells_three(spec)
+ count = count + 1
+ local step = steps[count]
+ step.cell_ali = spec
end
-function commands.step_cell(top)
- steps[#steps+1] = {
- cell_top = top or "",
- cell_bot = "",
- text_top = "",
- text_mid = "",
- text_bot = "",
- }
+local function step_texts(spec)
+ if count > 0 then
+ local step = steps[count]
+ step.text_top = spec
+ step.text_bot = spec
+ end
end
-function commands.step_text(top)
- if #steps > 0 then
- steps[#steps].text_top = top or ""
- end
+local function step_cell(spec)
+ count = count + 1
+ steps[count].cell_top = spec
end
-function commands.step_textset(left,middle,right)
- if #steps > 0 then
- steps[#steps].text_top = left or ""
- steps[#steps].text_mid = middle or ""
- steps[#steps].text_bot = right or ""
+local function step_text(spec)
+ if count > 0 then
+ local c = count
+ while true do
+ local step = steps[c]
+ if step.text_top then
+ c = c + 1
+ step = steps[c]
+ else
+ step.text_top = spec
+ step.start_b = count
+ break
+ end
+ end
end
end
-function commands.step_start_cell()
- steps[#steps+1] = {
- cell_top = "",
- cell_bot = "",
- text_top = "",
- text_mid = "",
- text_bot = "",
- }
+local function step_start_cell()
+ count = count + 1
+ local step = steps[count] -- creates
end
-function commands.step_stop_cell()
+local function step_stop_cell()
end
-function commands.step_text_top(str)
- if #steps > 0 then
- steps[#steps].text_top = str or ""
+local function step_text_top(spec)
+ if count > 0 then
+ steps[count].text_top = spec
end
end
-function commands.step_text_mid(str)
- if #steps > 0 then
- steps[#steps].text_mid = str or ""
+local function step_text_mid(spec)
+ if count > 0 then
+ steps[count].text_mid = spec
end
end
-function commands.step_text_bot(str)
- if #steps > 0 then
- steps[#steps].text_bot = str or ""
+local function step_text_bot(spec)
+ if count > 0 then
+ steps[count].text_bot = spec
end
end
-function commands.step_cell_top(str)
- if #steps > 0 then
- steps[#steps].cell_top = str or ""
+local function step_cell_top(spec)
+ if count > 0 then
+ steps[count].cell_top = spec
end
end
-function commands.step_cell_bot(str)
- if #steps > 0 then
- steps[#steps].cell_bot = str or ""
+local function step_cell_bot(spec)
+ if count > 0 then
+ steps[count].cell_bot = spec
end
end
+
+--
+
+interfaces.implement {
+ name = "step_start_chart",
+ arguments = { "string", "string" },
+ actions = step_start_chart,
+}
+
+interfaces.implement {
+ name = "step_stop_chart",
+ actions = step_stop_chart,
+}
+
+interfaces.implement {
+ name = "step_make_chart",
+ actions = step_make_chart,
+ arguments = {
+ {
+ { "chart", {
+ { "category" },
+ { "name" },
+ { "alternative" },
+ }
+ },
+ { "cell", {
+ { "alternative" },
+ { "offset", "dimension" },
+ { "rulethickness", "dimension" },
+ { "framecolor" },
+ { "backgroundcolor" },
+ { "dx", "dimension" },
+ { "dy", "dimension" },
+ }
+ },
+ { "text", {
+ { "alternative" },
+ { "offset", "dimension" },
+ { "distance", "dimension" },
+ { "rulethickness", "dimension" },
+ { "framecolor" },
+ { "backgroundcolor" },
+ }
+ },
+ { "line", {
+ { "alternative" },
+ { "rulethickness", "dimension" },
+ { "height", "dimension" },
+ { "distance", "dimension" },
+ { "offset", "dimension" },
+ { "color" },
+ }
+ }
+ }
+ }
+}
+
+local step_spec = {
+ {
+ { "text", {
+ { "top" },
+ { "middle" },
+ { "mid" },
+ { "bot" },
+ { "left" },
+ { "right" },
+ }
+ },
+ { "shape", {
+ { "rulethickness", "dimension" },
+ { "alternative" },
+ { "framecolor" },
+ { "backgroundcolor" },
+ }
+ },
+ { "line", {
+ { "alternative" },
+ { "rulethickness", "dimension" },
+ { "color" },
+ { "offset", "dimension" },
+ }
+ }
+ }
+}
+
+interfaces.implement {
+ name = "step_cell",
+ arguments = step_spec,
+ actions = step_cell,
+}
+
+interfaces.implement {
+ name = "step_text",
+ arguments = step_spec,
+ actions = step_text,
+}
+
+interfaces.implement {
+ name = "step_text_top",
+ arguments = step_spec,
+ actions = step_text_top,
+}
+
+interfaces.implement {
+ name = "step_text_mid",
+ arguments = step_spec,
+ actions = step_text_mid,
+}
+
+interfaces.implement {
+ name = "step_text_bot",
+ arguments = step_spec,
+ actions = step_text_bot,
+}
+
+interfaces.implement {
+ name = "step_cell_top",
+ arguments = step_spec,
+ actions = step_cell_top,
+}
+
+interfaces.implement {
+ name = "step_cell_bot",
+ arguments = step_spec,
+ actions = step_cell_bot,
+}
+
+interfaces.implement {
+ name = "step_start_cell",
+ actions = step_start_cell,
+}
+
+interfaces.implement {
+ name = "step_stop_cell",
+ actions = step_stop_cell,
+}
+
+interfaces.implement {
+ name = "step_texts",
+ arguments = step_spec,
+ actions = step_texts,
+}
+
+interfaces.implement {
+ name = "step_cells",
+ arguments = step_spec,
+ actions = step_cells,
+}
+
+interfaces.implement {
+ name = "step_cells_three",
+ arguments = step_spec,
+ actions = step_cells_three,
+}
diff --git a/tex/context/modules/mkiv/m-steps.mkvi b/tex/context/modules/mkiv/m-steps.mkvi
index c9c5a0636..873015fd6 100644
--- a/tex/context/modules/mkiv/m-steps.mkvi
+++ b/tex/context/modules/mkiv/m-steps.mkvi
@@ -11,66 +11,71 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-% multiple texts?
+% This code is not optimized.
\registerctxluafile{m-steps}{}
\unprotect
+\defineMPinstance
+ [steps]
+ [\s!format=metafun,
+ \s!extensions=\v!yes,
+ \s!initializations=\v!yes]
+ %\c!method=\s!double]
+
+\startMPdefinitions{steps}
+ loadmodule "step" ;
+\stopMPdefinitions
+
\installcorenamespace {stepcharts}
-\installcorenamespace {steptables}
\installcorenamespace {stepcells}
\installcorenamespace {steptexts}
\installcorenamespace {steplines}
-\installsimplecommandhandler \??stepcharts {STEPchart} \??stepcharts
-\installsimplecommandhandler \??steptables {STEPtable} \??steptables
-\installsimplecommandhandler \??stepcells {STEPcell} \??stepcells
-\installsimplecommandhandler \??steptexts {STEPtext} \??steptexts
-\installsimplecommandhandler \??steplines {STEPline} \??steplines
+\installstylisticautosetuphandler \??stepcharts {STEPchart} \??stepcharts
+\installstylisticautosetuphandler \??stepcells {STEPcell} \??stepcells
+\installstylisticautosetuphandler \??steptexts {STEPtext} \??steptexts
+\installstylisticautosetuphandler \??steplines {STEPline} \??steplines
\let\setupSTEPcharts\setupSTEPchart
-\let\setupSTEPtables\setupSTEPtable
+\let\setupSTEPtables\setupSTEPchart % one can define categories so no need
\let\setupSTEPcells \setupSTEPcell
\let\setupSTEPtexts \setupSTEPtext
\let\setupSTEPlines \setupSTEPline
+\let\setSTEPchartsparameter\setSTEPchartparameter
+\let\setSTEPcellsparameter \setSTEPcellparameter
+\let\setSTEPtextsparameter \setSTEPtextparameter
+\let\setSTEPlinesparameter \setSTEPlineparameter
+
% numeric text_text_distance ; text_text_distance := 20pt ;
% numeric step_distance ; step_distance := 20pt ;
\setupSTEPcharts
- [\c!alternative=\v!horizontal,
+ [%c!alternative=\v!horizontal, % travels with stored so dealt with in lua
+ %\c!offset=.15\bodyfontsize
+ %\c!height=2ex
\c!before=\blank,
\c!after=\blank]
-% \c!offset=.15\bodyfontsize
-% \c!height=2ex
-
-% \setupSTEPtables
-% [\c!before=\blank,
-% \c!after=\blank,
-% \c!distance=.25em,
-% \c!voffset=1ex,
-% \c!method=1,
-% \c!width=4em,
-% \c!offset=.15\bodyfontsize]
\setupSTEPcells
- [\c!alternative=1, % TODO
-% \c!style=,
-% \c!color=,
+ [\c!alternative=24,
+ \c!style=,
+ \c!color=,
\c!dx=\bodyfontsize,
\c!dy=\bodyfontsize,
- \c!background=\v!color,
+ % \c!background=\v!color,
\c!backgroundcolor=STEPbackgroundcolor,
\c!rulethickness=.1\bodyfontsize,
\c!framecolor=STEPframecolor,
\c!offset=.25\bodyfontsize]
\setupSTEPtexts
- [\c!alternative=1, % TODO
-% \c!style=\v!smallbodyfont,
-% \c!color=,
- \c!background=\v!color,
+ [\c!alternative=24,
+ \c!style=\v!smallbodyfont,
+ \c!color=,
+ % \c!background=\v!color,
\c!backgroundcolor=STEPbackgroundcolor,
\c!rulethickness=.1\bodyfontsize,
\c!framecolor=STEPframecolor,
@@ -78,9 +83,10 @@
\c!offset=.25\bodyfontsize]
\setupSTEPlines
- [\c!alternative=1, % TODO
+ [\c!alternative=1,
\c!rulethickness=.15\bodyfontsize,
- \c!height=3\bodyfontsize,
+ \c!height=\STEPlineparameter\c!width,
+ \c!width=3\bodyfontsize,
\c!distance=.5\bodyfontsize,
\c!offset=.25\bodyfontsize,
\c!color=STEPlinecolor]
@@ -89,31 +95,78 @@
\definecolor [STEPframecolor] [s=.7]
\definecolor [STEPbackgroundcolor] [s=.9]
+\newcount\c_module_steps_tag
+\newmacro\m_module_steps_category
+
+\unexpanded\def\setSTEPbox#tag#str%
+ {\setbox\scratchbox\hbox\bgroup
+ \begstrut
+ \ignorespaces
+ #str%
+ \removeunwantedspaces
+ \endstrut
+ \egroup
+ \ifzeropt\wd\scratchbox
+ \let#1\empty
+ \else
+ \global\advance\c_module_steps_tag\plusone
+ \edef#tag{\the\c_module_steps_tag}%
+ \putboxincache{\??stepcharts\m_module_steps_category}{#tag}\scratchbox
+ \fi}
+
\newtoks\everySTEPchart
+% we used to save charts but that is tricky with so much delegated to lua
+% and mp so now we do support a buffered way only
+
+\def\module_steps_syncronize
+ {\let\currentSTEPtext\p_category
+ \let\currentSTEPcell\p_category
+ \let\currentSTEPline\p_category
+ \checkSTEPcellparent
+ \checkSTEPtextparent
+ \checkSTEPlineparent}
+
\unexpanded\def\startSTEPchart
{\begingroup
\dodoubleempty\module_steps_start_chart}
\def\module_steps_start_chart[#name][#settings]%
- {\startnointerference
- \iffirstargument
+ {\iffirstargument
\doifelseassignment{#name}
{\let\currentSTEPchart\empty
- \xdef\module_steps_flush_chart{\module_steps_chart[][#name]}}
+ \let\m_module_steps_category\empty
+ \setupcurrentSTEPchart[#name]%
+ \def\module_steps_flush_chart{\module_steps_chart[][#name]}}
{\edef\currentSTEPchart{#name}%
- \glet\module_steps_flush_chart\relax}% settings are not stored
+ \setupcurrentSTEPchart[#settings]%
+ \let\m_module_steps_category\currentSTEPchart
+ \resetboxesincache{\??stepcharts\m_module_steps_category}%
+ \doifelse{\STEPchartparameter\c!buffer}\v!no
+ {\def\module_steps_flush_chart{\STEPchart[#name]}}
+ {\let\module_steps_flush_chart\relax}}%
\else
\let\currentSTEPchart\empty
- \gdef\module_steps_flush_chart{\module_steps_chart[][]}%
+ \def\module_steps_flush_chart{\module_steps_chart[][]}%
\fi
+ \edef\p_category{\STEPchartparameter\c!category}%
+ \let\currentSTEPtext\p_category
+ \let\currentSTEPcell\p_category
+ \let\currentSTEPline\p_category
+ \checkSTEPcellparent
+ \checkSTEPtextparent
+ \checkSTEPlineparent
\the\everySTEPchart
- \ctxcommand{step_start_chart("\currentSTEPchart")}}
+ \startnointerference
+ \clf_step_start_chart{\currentSTEPchart}{\STEPchartparameter\c!alternative}}
\unexpanded\def\stopSTEPchart
- {\ctxcommand{step_stop_chart()}%
+ {\clf_step_stop_chart
\stopnointerference
\module_steps_flush_chart
+ \ifx\m_module_steps_category\empty
+ \resetboxesincache{\??stepcharts}%
+ \fi
\endgroup}
\unexpanded\def\startSTEPtable
@@ -123,13 +176,24 @@
\let\stopSTEPtable\stopSTEPchart
+\unexpanded\def\startSTEPaligntable
+ {\begingroup
+ \setupSTEPchart[\c!alternative={\v!vertical,\v!three}]%
+ \let\module_steps_cells\module_steps_cells_three % no nesting yet
+ \dodoubleempty\module_steps_start_chart}
+
+\let\stopSTEPaligntable\stopSTEPchart
+
\let\module_steps_flush_chart\relax
+% \resetboxesincache\??stepcharts
+
\unexpanded\def\STEPchart
{\dodoubleempty\module_steps_chart}
\unexpanded\def\module_steps_chart[#name][#settings]%
{\begingroup
+ \edef\m_module_steps_category{#name}%
\setupSTEPchart[#settings]%
\ifinsidefloat
\makeSTEPchart[#name]%
@@ -137,129 +201,300 @@
\STEPchartparameter\c!before
\startbaselinecorrection
\setlocalhsize
- \makeSTEPchart[#name]%
+ \dontleavehmode\vpack{\makeSTEPchart[#name]}% we need to ensure leftskip
\stopbaselinecorrection
\STEPchartparameter\c!after
\fi
\endgroup}
\unexpanded\def\makeSTEPchart[#name]%
- {\ctxcommand{step_make_chart {
- chart = {
- name = "#name",
- alternative = "\STEPchartparameter\c!alternative",
- },
- cell = {
- alternative = "\STEPcellparameter\c!alternative", % TODO: shapes
- offset = \number\dimexpr\STEPcellparameter\c!offset,
- rulethickness = \number\dimexpr\STEPcellparameter\c!rulethickness,
- framecolor = "\STEPcellparameter\c!framecolor",
- backgroundcolor = "\STEPcellparameter\c!backgroundcolor",
- dx = \number\dimexpr\STEPcellparameter\c!dx,
- dy = \number\dimexpr\STEPcellparameter\c!dy,
- },
- text = {
- alternative = "\STEPtextparameter\c!alternative", % TODO: shapes
- offset = \number\dimexpr\STEPtextparameter\c!offset,
- distance = \number\dimexpr\STEPtextparameter\c!distance,
- rulethickness = \number\dimexpr\STEPtextparameter\c!rulethickness,
- framecolor = "\STEPtextparameter\c!framecolor",
- backgroundcolor = "\STEPtextparameter\c!backgroundcolor",
- },
- line = {
- alternative = "\STEPlineparameter\c!alternative", % TODO: dash, arrow
- rulethickness = \number\dimexpr\STEPlineparameter\c!rulethickness,
- height = \number\dimexpr\STEPlineparameter\c!height,
- distance = \number\dimexpr\STEPlineparameter\c!distance,
- offset = \number\dimexpr\STEPlineparameter\c!offset,
- color = "\STEPlineparameter\c!color",
- },
- }}}
-
-\unexpanded\def\startSTEPcell
- {\ctxcommand{step_start_cell()}}
-
-\unexpanded\def\stopSTEPcell
- {\ctxcommand{step_stop_cell()}}
-
-\unexpanded\def\module_steps_cells#top#bot%
- {\ctxcommand{step_cells(\!!bs\detokenize{#top}\!!es,\!!bs\detokenize{#bot}\!!es)}}
-
-\unexpanded\def\module_steps_texts#top#bot%
- {\ctxcommand{step_texts(\!!bs\detokenize{#top}\!!es,\!!bs\detokenize{#bot}\!!es)}}
-
-\unexpanded\def\module_steps_cell#str%
- {\ctxcommand{step_cell(\!!bs\detokenize{#str}\!!es)}}
-
-\unexpanded\def\module_steps_text#str%
- {\ctxcommand{step_text(\!!bs\detokenize{#str}\!!es)}}
-
-\unexpanded\def\module_steps_textset#left#middle#right%
- {\ctxcommand{step_textset(\!!bs\detokenize{#left}\!!es,\!!bs\detokenize{#middle}\!!es,\!!bs\detokenize{#right}\!!es)}}
-
-\unexpanded\def\module_steps_toptext#top%
- {\ctxcommand{step_text_top(\!!bs\detokenize{#top}\!!es)}}
-
-\unexpanded\def\module_steps_bottext#bot%
- {\ctxcommand{step_text_bot(\!!bs\detokenize{#bot}\!!es)}}
-
-\unexpanded\def\module_steps_topcell#top%
- {\ctxcommand{step_cell_top(\!!bs\detokenize{#top}\!!es)}}
-
-\unexpanded\def\module_steps_botcell#bot%
- {\ctxcommand{step_cell_bot(\!!bs\detokenize{#bot}\!!es)}}
+ {\clf_step_make_chart
+ chart {
+ category {\??stepcharts\m_module_steps_category}
+ name {#name}
+ alternative {\STEPchartparameter\c!alternative}
+ }
+ cell {
+ alternative {\STEPcellparameter\c!alternative}
+ offset \dimexpr\STEPcellparameter\c!offset\relax
+ rulethickness \dimexpr\STEPcellparameter\c!rulethickness\relax
+ framecolor {\STEPcellparameter\c!framecolor}
+ backgroundcolor {\STEPcellparameter\c!backgroundcolor}
+ dx \dimexpr\STEPcellparameter\c!dx\relax
+ dy \dimexpr\STEPcellparameter\c!dy\relax
+ }
+ text {
+ alternative {\STEPtextparameter\c!alternative}
+ offset \dimexpr\STEPtextparameter\c!offset\relax
+ distance \dimexpr\STEPtextparameter\c!distance\relax
+ rulethickness \dimexpr\STEPtextparameter\c!rulethickness\relax
+ framecolor {\STEPtextparameter\c!framecolor}
+ backgroundcolor {\STEPtextparameter\c!backgroundcolor}
+ }
+ line {
+ alternative {\STEPlineparameter\c!alternative}
+ rulethickness \dimexpr\STEPlineparameter\c!rulethickness\relax
+ height \dimexpr\STEPlineparameter\c!height\relax
+ distance \dimexpr\STEPlineparameter\c!distance\relax
+ offset \dimexpr\STEPlineparameter\c!offset\relax
+ color {\STEPlineparameter\c!color}
+ }
+ \relax}
+
+\unexpanded\def\startSTEPcell{\clf_step_start_cell}
+\unexpanded\def\stopSTEPcell {\clf_step_stop_cell}
+
+\unexpanded\def\module_steps_cells {\dosingleempty\module_steps_cells_indeed}
+\unexpanded\def\module_steps_cells_three{\dosingleempty\module_steps_cells_three_indeed}
+\unexpanded\def\module_steps_texts {\dosingleempty\module_steps_texts_indeed}
+\unexpanded\def\module_steps_cell {\dosingleempty\module_steps_cell_indeed}
+\unexpanded\def\module_steps_text {\dosingleempty\module_steps_text_indeed}
+\unexpanded\def\module_steps_toptext {\dosingleempty\module_steps_toptext_indeed}
+\unexpanded\def\module_steps_bottext {\dosingleempty\module_steps_bottext_indeed}
+\unexpanded\def\module_steps_topcell {\dosingleempty\module_steps_topcell_indeed}
+\unexpanded\def\module_steps_botcell {\dosingleempty\module_steps_botcell_indeed}
+
+\def\module_steps_check_cell#category%
+ {\edef\p_category{#category}%
+ \ifx\p_category\empty \else
+ \let\currentSTEPcell\p_category
+ \let\currentSTEPline\p_category
+ \checkSTEPcellparent
+ \checkSTEPlineparent
+ \fi}
+
+\def\module_steps_check_text#category%
+ {\edef\p_category{#category}%
+ \ifx\p_category\empty \else
+ \let\currentSTEPtext\p_category
+ \let\currentSTEPline\p_category
+ \checkSTEPtextparent
+ \checkSTEPlineparent
+ \fi}
+
+\def\module_steps_pass_data#1#2%
+ {{
+ text {
+ #2
+ }
+ shape {
+ rulethickness \dimexpr#1\c!rulethickness\relax
+ alternative {#1\c!alternative}
+ framecolor {#1\c!framecolor}
+ backgroundcolor {#1\c!backgroundcolor}
+ }
+ line {
+ rulethickness \dimexpr\STEPlineparameter\c!rulethickness\relax
+ alternative {\STEPlineparameter\c!alternative}
+ color {\STEPlineparameter\c!color}
+ offset \dimexpr\STEPlineparameter\c!offset\relax
+ }
+ }}
+
+\def\module_steps_cells_indeed[#category]#top#bot%
+ {\begingroup
+ \iffirstargument
+ \module_steps_check_cell{#category}%
+ \fi
+ \useSTEPcellstyleandcolor\c!style\c!color
+ \setSTEPbox\module_steps_tag_a{#top}%
+ \setSTEPbox\module_steps_tag_b{#bot}%
+ \clf_step_cells \module_steps_pass_data \STEPcellparameter {
+ top {\module_steps_tag_a}
+ bot {\module_steps_tag_b}
+ }
+ \endgroup}
+
+\def\module_steps_cells_three_indeed[#category]#one#two#three%
+ {\begingroup
+ \iffirstargument
+ \module_steps_check_cell{#category}%
+ \fi
+ \useSTEPcellstyleandcolor\c!style\c!color
+ \setSTEPbox\module_steps_tag_a{#one}%
+ \setSTEPbox\module_steps_tag_b{#two}%
+ \setSTEPbox\module_steps_tag_c{#three}%
+ \clf_step_cells_three \module_steps_pass_data \STEPcellparameter {
+ left {\module_steps_tag_a}
+ middle {\module_steps_tag_b}
+ right {\module_steps_tag_c}
+ }%
+ \endgroup}
+
+\def\module_steps_texts_indeed[#category]#top#bot%
+ {\begingroup
+ \iffirstargument
+ \module_steps_check_text{#category}%
+ \fi
+ \useSTEPtextstyleandcolor\c!style\c!color
+ \setSTEPbox\module_steps_tag_a{#top}%
+ \setSTEPbox\module_steps_tag_b{#bot}%
+ \clf_step_texts \module_steps_pass_data \STEPtextparameter {
+ top {\module_steps_tag_a}
+ bot {\module_steps_tag_b}
+ }%
+ \endgroup}
+
+\def\module_steps_cell_indeed[#category]#str%
+ {\begingroup
+ \iffirstargument
+ \module_steps_check_cell{#category}%
+ \fi
+ \useSTEPcellstyleandcolor\c!style\c!color
+ \setSTEPbox\module_steps_tag_a{#str}%
+ \clf_step_cell \module_steps_pass_data \STEPcellparameter {
+ top {\module_steps_tag_a}
+ }%
+ \endgroup}
+
+\def\module_steps_text_indeed[#category]#str%
+ {\begingroup
+ \iffirstargument
+ \module_steps_check_text{#category}%
+ \fi
+ \useSTEPtextstyleandcolor\c!style\c!color
+ \setSTEPbox\module_steps_tag_a{#str}%
+ \clf_step_text \module_steps_pass_data \STEPtextparameter {
+ top {\module_steps_tag_a}
+ }%
+ \endgroup}
+
+\def\module_steps_toptext_indeed[#category]#top%
+ {\begingroup
+ \iffirstargument
+ \module_steps_check_text{#category}%
+ \fi
+ \useSTEPtextstyleandcolor\c!style\c!color
+ \setSTEPbox\module_steps_tag_a{#top}%
+ \clf_step_text_top \module_steps_pass_data \STEPtextparameter {
+ top {\module_steps_tag_a}
+ }%
+ \endgroup}
+
+\def\module_steps_bottext_indeed[#category]#bot%
+ {\begingroup
+ \iffirstargument
+ \module_steps_check_text{#category}%
+ \fi
+ \useSTEPtextstyleandcolor\c!style\c!color
+ \setSTEPbox\module_steps_tag_a{#bot}%
+ \clf_step_text_bot \module_steps_pass_data \STEPtextparameter {
+ bot {\module_steps_tag_a}
+ }%
+ \endgroup}
+
+\def\module_steps_topcell_indeed[#category]#top%
+ {\begingroup
+ \iffirstargument
+ \module_steps_check_cell{#category}%
+ \fi
+ \useSTEPcellstyleandcolor\c!style\c!color
+ \setSTEPbox\module_steps_tag_a{#top}%
+ \clf_step_cell_top \module_steps_pass_data \STEPcellparameter {
+ top {\module_steps_tag_a}
+ }%
+ \endgroup}
+
+\def\module_steps_botcell_indeed[#category]#bot%
+ {\begingroup
+ \iffirstargument
+ \module_steps_check_cell{#category}%
+ \fi
+ \useSTEPcellstyleandcolor\c!style\c!color
+ \setSTEPbox\module_steps_tag_a{#bot}%
+ \clf_step_cell_bot \module_steps_pass_data \STEPcellparameter {
+ bot {\module_steps_tag_a}
+ }%
+ \endgroup}
\appendtoks
\let\cells \module_steps_cells
\let\texts \module_steps_texts
\let\cell \module_steps_cell
\let\text \module_steps_text
- \let\textset\module_steps_textset
\let\toptext\module_steps_toptext
\let\bottext\module_steps_bottext
\let\topcell\module_steps_topcell
\let\botcell\module_steps_botcell
\to \everySTEPchart
-% todo: mapping can be done in lua
+% The xml interface:
+
+\unexpanded\def\setSTEPxmldirective#1#2#3%
+ {\begincsname setSTEP#1parameter\endcsname{#2}{#3}}
+
+\xmlinstalldirective{stepchart}{setSTEPxmldirective}
\startxmlsetups xml:step:define
- \xmlsetsetup{#1} {stepchart|steptable} {xml:step:*}
+ \xmlsetsetup
+ {#1}
+ {stepchart|steptable|stepaligntable|cells|texts|stepcell|cell|text}
+ {xml:step:*}
\stopxmlsetups
\xmlregistersetup{xml:step:define}
\startxmlsetups xml:step:stepchart
- \startSTEPchart
- \xmlfilter{#1}{/(cells|texts|stepcell|cell|text)/command(xml:step:*)}
+ \startSTEPchart[\c!category=\xmlatt{#1}{class}]
+ \xmlflush{#1}
\stopSTEPchart
\stopxmlsetups
\startxmlsetups xml:step:steptable
- \startSTEPtable
- \xmlfilter{#1}{/(cells|texts|stepcell|cell|text)/command(xml:step:*)}
+ \startSTEPtable[\c!category=\xmlatt{#1}{class}]
+ \xmlflush{#1}
\stopSTEPtable
\stopxmlsetups
+\startxmlsetups xml:step:stepaligntable
+ \startSTEPaligntable[\c!category=\xmlatt{#1}{class}]
+ \xmlflush{#1}
+ \stopSTEPaligntable
+\stopxmlsetups
+
\startxmlsetups xml:step:cells
- \cells {\xmltext{#1}{/top}} {\xmltext{#1}{/bot}}
+ \xmldoifelse {#1} {/c1} {
+ \cells
+ [\xmlatt{#1}{class}]
+ {\xmltext{#1}{/c1}}
+ {\xmltext{#1}{/c2}}
+ {\xmltext{#1}{/c3}}
+ } {
+ \cells
+ [\xmlatt{#1}{class}]
+ {\xmltext{#1}{/top}}
+ {\xmltext{#1}{/bot}}
+ }
\stopxmlsetups
\startxmlsetups xml:step:texts
- \texts {\xmltext{#1}{/top}} {\xmltext{#1}{/bot}}
+ \texts
+ [\xmlatt{#1}{class}]
+ {\xmltext{#1}{/top}}
+ {\xmltext{#1}{/bot}}
\stopxmlsetups
\startxmlsetups xml:step:stepcell
- \cells {\xmltext{#1}{/topcell}} {\xmltext{#1}{/botcell}}
- \texts {\xmltext{#1}{/toptext}} {\xmltext{#1}{/bottext}}
+ \cells
+ [\xmlatt{#1}{class}]
+ {\xmltext{#1}{/topcell}}
+ {\xmltext{#1}{/botcell}}
+ \texts
+ [\xmlatt{#1}{class}]
+ {\xmltext{#1}{/toptext}}
+ {\xmltext{#1}{/bottext}}
\stopxmlsetups
\startxmlsetups xml:step:cell
- \cell {\xmlflush{#1}}
+ \cell
+ [\xmlatt{#1}{class}]
+ {\xmlflush{#1}}
\stopxmlsetups
\startxmlsetups xml:step:text
- \text {\xmlflush{#1}}
+ \text
+ [\xmlatt{#1}{class}]
+ {\xmlflush{#1}}
\stopxmlsetups
\protect
@@ -268,11 +503,13 @@
\starttext
+\setupSTEPcells[demo-1][style=bold]
+
\startbuffer
<stepchart>
<cell> some cell </cell>
<text> some text </text>
- <cell> some cell </cell>
+ <cell class="demo-1"> some cell </cell>
<text> some text </text>
<cell> some cell </cell>
</stepchart>
@@ -280,7 +517,6 @@
\typebuffer \processxmlbuffer
-
\startbuffer
<steptable>
<cell> some cell </cell>
@@ -304,15 +540,6 @@
\cells {five} {one}
\stopSTEPchart
-\startSTEPtable
- \cell {one} \textset{$x$} {=}{$a+b+c$}
- \cell {two} \textset{$c+d$}{=}{$y$}
- \cell {three}
-\stopSTEPtable
-
-
-\page
-
\startbuffer
<stepchart>
<cells> <top> some text </top> <bot> some text </bot> </cells>
@@ -379,4 +606,53 @@
\page
+\setupSTEPchart
+ [mytable]
+ [before={\blank[2*big]},
+ after={\blank[2*big]}]
+
+\starttext
+
+\startSTEPaligntable[mytable]
+ \cells {$2c$} {$=$} {$2a+3b$}
+ \text {with $a=5$}
+ \cells {$2c$}{$=$} {$10+3b$}
+ \text {and $b=6$}
+ \cells {$2c$} {$=$} {$10+18$}
+ \text {we get}
+ \cells {$2c$} {$=$} {$28$}
+ \text {and therefore}
+ \cells {$c$} {$=$} {$28/2$}
+ \text {which reduces to}
+ \cells {$c$} {$=$} {$14$}
+\stopSTEPaligntable
+
+\input tufte
+
+\STEPchart[mytable]
+
+\input tufte
+
+\setupSTEPchart
+ [mytable]
+ [buffer=no]
+
+\startSTEPaligntable[mytable]
+ \cells {$2c$} {$=$} {$2a+3b$}
+ \text {with $a=5$}
+ \cells {$2c$}{$=$} {$10+3b$}
+ \text {and $b=6$}
+ \cells {$2c$} {$=$} {$10+18$}
+ \text {we get}
+ \cells {$2c$} {$=$} {$28$}
+ \text {and therefore}
+ \cells {$c$} {$=$} {$28/2$}
+ \text {which reduces to}
+ \cells {$c$} {$=$} {$14$}
+\stopSTEPaligntable
+
+\input tufte
+
+\STEPchart[mytable]
+
\stoptext
diff --git a/tex/context/modules/mkiv/m-visual.mkiv b/tex/context/modules/mkiv/m-visual.mkiv
index 01fae49e2..6ec0a52b0 100644
--- a/tex/context/modules/mkiv/m-visual.mkiv
+++ b/tex/context/modules/mkiv/m-visual.mkiv
@@ -14,7 +14,8 @@
\unprotect
%D Much will probably be replaced by \LUA\ based solutions which is
-%D rather trivial and fun doing.
+%D rather trivial and fun doing. A lot here makes no sense any more,
+%D for instance whatsits are not used.
%D This module collect a few more visual debugger features. I
%D needed them for manuals and styles. The macros are documented
@@ -24,13 +25,18 @@
\definecolor[fakebaselinecolor] [green]
\definecolor[fakeparindentcolor][blue]
-\newif\iffakebaseline \fakebaselinetrue
-\newif\iffaketrigger \faketriggerfalse
+\newif \iffakebaseline \fakebaselinetrue
+\newif \iffaketrigger \faketriggerfalse
+\newdimen \fakerulewidth \fakerulewidth=.2pt
\unexpanded\def\fakerule#1%
{\strut
\begingroup
- \directcolored[fakerulecolor]%
+ \ifx\fakerulecolor\relax
+ \directcolored[fr\recurselevel c]%
+ \else
+ \directcolored[fakerulecolor]%
+ \fi
\iffakebaseline
\vrule\s!height1.25\exheight\s!depth-.05\exheight\s!width#1%
\kern-#1%
@@ -75,7 +81,9 @@
fr8c=darkorange]
\unexpanded\def\onlyfakewords#1#2% min max / 10 40
- {\getrandomcount\scratchcounter{\ifcase0#1 10\else#1\fi}{\ifcase0#2 40\else#2\fi}%
+ {\dontleavehmode
+ \ifvmode\noindentation\fi
+ \getrandomcount\scratchcounter{\ifcase0#1 10\else#1\fi}{\ifcase0#2 40\else#2\fi}%
\dofakewords\scratchcounter
} % no \par
@@ -102,7 +110,7 @@
\def\doshowfakewords#1%
{\bgroup
\setuppalet[fakerule]%
- \definecolor[fakerulecolor]%
+ \let\fakerulecolor\relax
\dorecurse{#1}
{\getrandomcount\scratchcounter{1}{5}%
\dorecurse\scratchcounter
@@ -141,19 +149,17 @@
\def\dofakedroppedcaps
{\setbox\scratchbox\hpack
{\setbox\scratchbox\hpack{W}%
- \scratchdimen#1\lineheight
- \advance\scratchdimen -\lineheight
- \advance\scratchdimen \dp\strutbox
+ \scratchdimen\dimexpr#1\lineheight-\lineheight+\dp\strutbox\relax
\vrule
\s!width#1\wd\scratchbox
\s!height\ht\scratchbox
\s!depth\scratchdimen}%
\ht\scratchbox\ht\strutbox
\dp\scratchbox\dp\strutbox
- \hangindent\wd\scratchbox
- \advance\hangindent .5em
+ \hangindent\dimexpr\wd\scratchbox+.5\emwidth\relax
\wd\scratchbox\hangindent
- \hangafter-#1\noindent
+ \hangafter-#1%
+ \noindent
\llap{\fakeparindentcolor\box\scratchbox}}%
\fi}
@@ -169,13 +175,15 @@
\doifelseinset{#1}{\v!left,\v!right}
{\fakewords{2}{4}}
{\fakewords{4}{10}}}%
- {\doifinset{#1}{\v!left,\v!right}
- {\dimen0=.75\dimen0
- \ifdim\dimen0>.6\hsize \dimen0=.5\hsize\fi
- \ifdim\dimen0<.3\hsize \dimen0=.3\hsize\fi}%
+ {\getrandomdimen\scratchdimenone{#3}{#4}%
+ \getrandomdimen\scratchdimentwo{#5}{#6}%
+ \doifinset{#1}{\v!left,\v!right}
+ {\scratchdimenone.75\scratchdimenone
+ \ifdim\scratchdimenone>.6\hsize \scratchdimenone.5\hsize\fi
+ \ifdim\scratchdimenone<.3\hsize \scratchdimenone.3\hsize\fi}%
\framed
- [\c!width=\dimen0,
- \c!height=\dimen2,
+ [\c!width=\scratchdimenone,
+ \c!height=\scratchdimentwo,
\c!frame=\v!off,
\c!background=\v!color,
\c!backgroundcolor=fakeparindentcolor]
@@ -183,25 +191,25 @@
\defrostrandomseed}
\unexpanded\def\fakeimage#1#2#3#4%
- {\getrandomdimen{\dimen0}{#1}{#3}%
- \getrandomdimen{\dimen2}{#2}{#4}%
+ {\getrandomdimen\scratchdimenone{#1}{#3}%
+ \getrandomdimen\scratchdimentwo{#2}{#4}%
\framed
- [\c!width=\dimen0,
- \c!height=\dimen2,
+ [\c!width=\scratchdimenone,
+ \c!height=\scratchdimentwo,
\c!frame=\v!off,
\c!background=\v!color,
\c!backgroundcolor=fakeparindentcolor]
{}}
\unexpanded\def\fakeformula
- {\dimen0\zeropoint
+ {\scratchdimenone\zeropoint
\getrandomcount\scratchcounter{3}{6}%
\dorecurse\scratchcounter
- {\getrandomdimen\scratchdimen{0.5em}{1.5em}%
- \mathord{\red\fakerule\scratchdimen}%
+ {\getrandomdimen\scratchdimentwo{0.5\emwidth}{1.5\emwidth}%
+ \mathord{\red\fakerule\scratchdimentwo}%
\ifnum\recurselevel<\scratchcounter+\fi
- \advance\scratchdimen\dimen0}%
- =\mathinner{\red\fakerule\scratchdimen}}
+ \advance\scratchdimentwo\scratchdimenone}%
+ =\mathinner{\red\fakerule\scratchdimentwo}}
\unexpanded\def\fakespacingformula
{\color[fakebaselinecolor]{\ruledbaseline}\fakeformula}
@@ -306,11 +314,10 @@
\scratchdimen#1\relax
\dontinterfere
\dontcomplain
- %boxrulewidth5\testrulewidth
#3#4\relax
\setbox\scratchbox\normalhbox to \scratchdimen
{#2{\ruledhbox to \scratchdimen
- {\vrule #5 20\testrulewidth \s!width \zeropoint
+ {\vrule #5 20\fakerulewidth \s!width \zeropoint
\normalhss}}}%
\smashbox\scratchbox
\normalpenalty\plustenthousand
@@ -321,8 +328,7 @@
{\ifdim\hangindent>\zeropoint
\ifnum\hangafter<\zerocount
\normalhbox
- {%boxrulewidth5\testrulewidth
- \setbox\scratchbox\ruledhbox to \hangindent
+ {\setbox\scratchbox\ruledhbox to \hangindent
{\scratchdimen\strutht
\advance\scratchdimen \strutdp
\vrule
@@ -354,7 +360,7 @@
\unexpanded\def\ruledpar
{\relax
\ifhmode
- \showparagraphcue{40\testrulewidth}\relax\rightrulefalse\relax\s!height
+ \showparagraphcue{40\fakerulewidth}\relax\rightrulefalse\relax\s!height
\fi
\normalpar}
@@ -362,7 +368,7 @@
{\relax
\normalnoindent
\ruledparagraphcues
- \showparagraphcue{40\testrulewidth}\llap\leftrulefalse\relax\s!height}
+ \showparagraphcue{40\fakerulewidth}\llap\leftrulefalse\relax\s!height}
\unexpanded\def\ruledindent
{\relax
@@ -371,7 +377,7 @@
\ifdim\parindent>\zeropoint
\showparagraphcue\parindent\relax\relax\relax\s!height
\else
- \showparagraphcue{40\testrulewidth}\llap\relax\relax\s!height
+ \showparagraphcue{40\fakerulewidth}\llap\relax\relax\s!height
\fi
\normalhskip\parindent}
@@ -381,10 +387,9 @@
\let\par \normalpar}
\unexpanded\def\showimplicits
- {\testrulewidth \defaulttestrulewidth
- \let\noindent \rulednoindent
- \let\indent \ruledindent
- \let\par \ruledpar}
+ {\let\noindent \rulednoindent
+ \let\indent \ruledindent
+ \let\par \ruledpar}
%D The next few||line examples show the four cues. Keep in
%D mind that we only see them when we explicitly open or close
@@ -434,8 +439,8 @@
\normalhbox
{\strut
\vrule
- \s!height \testrulewidth
- \s!depth \testrulewidth
+ \s!height \fakerulewidth
+ \s!depth \fakerulewidth
\s!width 120\points}
\normalvfill}%
\smashbox\scratchbox
@@ -452,8 +457,7 @@
\egroup}
\unexpanded\def\showbaselines
- {\testrulewidth\defaulttestrulewidth
- \EveryPar{\ruledbaseline}}
+ {\EveryPar{\ruledbaseline}}
%D \macros
%D {showpagebuilder}
@@ -504,7 +508,7 @@
{\vss\hpack to 3em{\hss#2\hss}\vss}%
\fi}}
-\def\colorrangeA#1%
+\unexpanded\def\colorrangeA#1%
{\vpack
{\startcolor[\s!white]%
\scratchdimen\dimexpr(-\colormarklength*4+\tractempheight+\tractempdepth)/21\relax
@@ -526,7 +530,7 @@
{\vss\hpack to \scratchdimen{\hss#1\hss}\vss}%
\fi}
-\def\colorrangeB
+\unexpanded\def\colorrangeB
{\hpack
{\startcolor[\s!white]%
\scratchdimen\dimexpr(-\colormarklength*\plustwo+\tractempwidth)/11\relax
@@ -553,7 +557,7 @@
{\vss\hpack to \scratchdimen{\hss#1\hss}\vss}%
\fi}
-\def\colorrangeC
+\unexpanded\def\colorrangeC
{\hpack
{\startcolor[\s!white]%
\scratchdimen\dimexpr(-\colormarklength*2+\tractempwidth)/14\relax
@@ -641,10 +645,10 @@
\let\supernormalmarks \normalmarks % mark may already been superseded
\unexpanded\def\showwhatsits
- {\protected\def\normalmark {\visualwhatsit100+m\supernormalmark }%
- \protected\def\normalmarks{\visualwhatsit100+m\supernormalmarks}%
- \protected\def\special {\visualwhatsit0100s\normalspecial }%
- \protected\def\write {\visualwhatsit001-w\normalwrite }%
+ {\unexpanded\def\normalmark {\visualwhatsit100+m\supernormalmark }%
+ \unexpanded\def\normalmarks{\visualwhatsit100+m\supernormalmarks}%
+ \unexpanded\def\special {\visualwhatsit0100s\normalspecial }%
+ \unexpanded\def\write {\visualwhatsit001-w\normalwrite }%
\let\immediate\immediatewhatsit
\appendtoks\dontshowwhatsits\to\everystoptext}
diff --git a/tex/context/modules/mkiv/s-characters-properties.lua b/tex/context/modules/mkiv/s-characters-properties.lua
new file mode 100644
index 000000000..dc9fb8f93
--- /dev/null
+++ b/tex/context/modules/mkiv/s-characters-properties.lua
@@ -0,0 +1,83 @@
+if not modules then modules = { } end modules ['s-characters-properties'] = {
+ version = 1.001,
+ comment = "companion to s-characters-properties.mkiv",
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "see context related readme files"
+}
+
+moduledata.characters = moduledata.characters or { }
+moduledata.characters.properties = moduledata.characters.properties or { }
+
+local catcodenames = { [0] =
+ "escape", "begingroup", "endgroup", "mathshift",
+ "alignment", "endofline", "parameter", "superscript",
+ "subscript", "ignore", "space", "letter",
+ "other", "active", "comment", "invalid",
+}
+
+table.swapped(catcodes,catcodes)
+
+local catcodes = context.catcodes
+local getcatcode = tex.getcatcode
+local c_context = catcodes.context
+local c_tex = catcodes.tex
+local c_protect = catcodes.protect
+local c_text = catcodes.text
+local c_verbatim = catcodes.verbatim
+
+local context = context
+local ctx_NC = context.NC
+local ctx_NR = context.NR
+local ctx_MR = context.MR
+local ctx_ML = context.ML
+local ctx_bold = context.bold
+local ctx_verbatim = context.verbatim
+
+function moduledata.characters.properties.showcatcodes(specification)
+
+ local function range(f,l,quit)
+ if quit then
+ ctx_MR()
+ end
+ for i=f,l do
+ ctx_NC()
+ if quit then
+ ctx_verbatim("%c .. %c",f,l)
+ else
+ ctx_verbatim("%c",i)
+ end
+ ctx_NC() context(catcodenames[getcatcode(c_tex,i)])
+ ctx_NC() context(catcodenames[getcatcode(c_context,i)])
+ ctx_NC() context(catcodenames[getcatcode(c_protect,i)])
+ ctx_NC() context(catcodenames[getcatcode(c_text,i)])
+ ctx_NC() context(catcodenames[getcatcode(c_verbatim,i)])
+ ctx_NC() ctx_NR()
+ if quit then
+ ctx_MR()
+ break
+ end
+ end
+ end
+
+ context.starttabulate { "|c|c|c|c|c|c|" }
+ ctx_ML()
+ ctx_NC() ctx_bold("ascii")
+ ctx_NC() ctx_bold("context")
+ ctx_NC() ctx_bold("tex")
+ ctx_NC() ctx_bold("protect")
+ ctx_NC() ctx_bold("text")
+ ctx_NC() ctx_bold("verbatim")
+ ctx_NC() ctx_NR()
+ ctx_ML()
+ range(32,47)
+ range(48,57,true)
+ range(58,64)
+ range(65,90,true)
+ range(91,96)
+ range(97,122,true)
+ range(123,126)
+ ctx_ML()
+ context.stoptabulate()
+
+end
diff --git a/tex/context/modules/mkiv/s-characters-properties.mkiv b/tex/context/modules/mkiv/s-characters-properties.mkiv
new file mode 100644
index 000000000..3c486c39c
--- /dev/null
+++ b/tex/context/modules/mkiv/s-characters-properties.mkiv
@@ -0,0 +1,30 @@
+%D \module
+%D [ file=s-characters-properties,
+%D version=2016.07.24, % moved here
+%D title=\CONTEXT\ Style File,
+%D subtitle=Character properties,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+\startmodule[characters-properties]
+
+\registerctxluafile{s-characters-properties}{}
+
+\installmodulecommandluasingle \showcharactercatcodes {moduledata.characters.properties.showcatcodes}
+
+\stopmodule
+
+\continueifinputfile{s-characters-properties.mkiv}
+
+\usemodule[art-01]
+
+\starttext
+
+ \showcharactercatcodes
+
+\stoptext
diff --git a/tex/context/modules/mkiv/s-domotica-settings.lua b/tex/context/modules/mkiv/s-domotica-settings.lua
new file mode 100644
index 000000000..a564ddf0e
--- /dev/null
+++ b/tex/context/modules/mkiv/s-domotica-settings.lua
@@ -0,0 +1,165 @@
+if not modules then modules = { } end modules ['s-domotica-settings'] = {
+ version = 1.001,
+ comment = "companion to s-domotica-settings.mkiv",
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "see context related readme files"
+}
+
+moduledata.domotica = moduledata.domotica or { }
+moduledata.domotica.settings = moduledata.domotica.settings or { }
+
+-- bah, no proper wrapper around value|help
+
+moduledata.zwave = moduledata.zwave or { }
+moduledata.hue = moduledata.hue or { }
+
+local NC = context.NC
+local BC = context.BC
+local NR = context.NR
+
+function moduledata.zwave.show_settings(pattern)
+
+ local function show(setting)
+
+ context.starttabulate { "|r|r|r|r|l|p|" }
+ BC() context("index")
+ -- BC() context("genre")
+ -- BC() context("instance")
+ BC() context("value")
+ BC() context("min")
+ BC() context("max")
+ BC() context("type")
+ BC() context("label")
+ BC() NR()
+ for value in xml.collected(setting,"/Value") do
+ local at = value.at
+ NC() context(at.index)
+ -- NC() context(at.genre)
+ -- NC() context(at.instance)
+ NC() context(at.value)
+ NC() context(at.min)
+ NC() context(at.max)
+ NC() context(at.type)
+ NC() context.escaped(at.label)
+ NC() NR()
+ end
+ context.stoptabulate()
+
+ end
+
+ if string.find(pattern,"%*") then
+
+ local list = dir.glob(pattern)
+ local last = nil
+
+ for i=1,#list do
+
+ local filename = list[i]
+ local root = xml.load(filename)
+ local settings = xml.all(root,"/Product/CommandClass[@id='112']")
+
+ if settings then
+
+ local brand = file.nameonly(file.pathpart(filename))
+ local device = file.nameonly(filename)
+
+ if last ~= brand then
+ context.startchapter { title = brand }
+ end
+
+ context.startsection { title = device }
+ for i=1,#settings do
+ show(settings[i])
+ end
+ context.stopsection()
+
+ if last ~= brand then
+ last = brand
+ context.stopchapter()
+ end
+
+ end
+
+ end
+
+ else
+
+ local root = xml.load(pattern)
+ local settings = xml.all(root,"/Product/CommandClass[@id='112']")
+
+ if settings then
+ for i=1,#settings do
+ show(settings[i])
+ end
+ end
+
+ end
+
+end
+
+function moduledata.hue.show_state(filename)
+
+ require("control-common")
+ require("control-hue")
+
+ local specification = domotica.hue.check(filename)
+ local instances = specification.instances
+
+ local ctx_NC, ctx_BC, ctx_NR = context.NC, context.BC, context.NR
+
+ for i=1,#instances do
+ local known = instances[i].knowndevices
+
+ if #instances > 1 then
+ context.subject("instance %i",i)
+ end
+
+ context.starttabulate { "|l|c|c|c|c|c|l|" }
+ ctx_BC() context("light name")
+ ctx_BC() context("id")
+ ctx_BC() context("state")
+ ctx_BC() context("level")
+ ctx_BC() context("color")
+ ctx_BC() context("seen")
+ ctx_BC() context("internal")
+ ctx_BC() ctx_NR()
+ for id, entry in table.sortedhash(known.lights) do
+ if entry.used then
+ local state = entry.state
+ local name = entry.name
+ local internal = entry.internalname
+ ctx_NC() context(entry.name)
+ ctx_NC() context(entry.identifier)
+ ctx_NC() context(state.on and "on " or "off")
+ ctx_NC() context(state.brightness or 0)
+ ctx_NC() context(state.temperature or 0)
+ ctx_NC() context((state.reachable or entry.reachable) and "yes" or "no ")
+ ctx_NC() if name == internal then context(name) else context.emphasized(internal) end
+ ctx_NC() ctx_NR()
+ end
+ end
+ context.stoptabulate()
+ context.starttabulate { "|l|c|c|c|l|" }
+ ctx_BC() context("sensor name")
+ ctx_BC() context("id")
+ ctx_BC() context("seen")
+ ctx_BC() context("battery")
+ ctx_BC() context("internal")
+ ctx_BC() ctx_NR()
+ for id, entry in table.sortedhash(known.sensors) do
+ if entry.used then
+ local state = entry.state
+ local name = entry.name
+ local internal = entry.internalname
+ ctx_NC() context(name)
+ ctx_NC() context(entry.identifier)
+ ctx_NC() context((state.reachable or entry.reachable) and "yes" or "no ")
+ ctx_NC() context(entry.battery or "")
+ ctx_NC() if name == internal then context(name) else context.emphasized(internal) end
+ ctx_NC() ctx_NR()
+ end
+ end
+ context.stoptabulate()
+ end
+end
diff --git a/tex/context/modules/mkiv/s-domotica-settings.mkiv b/tex/context/modules/mkiv/s-domotica-settings.mkiv
new file mode 100644
index 000000000..d32e53830
--- /dev/null
+++ b/tex/context/modules/mkiv/s-domotica-settings.mkiv
@@ -0,0 +1,26 @@
+%D \module
+%D [ file=s-domotica-setting,
+%D version=2016.10.20,
+%D title=\CONTEXT\ Style File,
+%D subtitle=Domotica Helpers,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+%D This module is part of some experiments that I do with gadgets that
+%D communicate with zwave, zigbee and other (wireless) protocols used in
+%D smart home applications.
+
+% see mtx-context-domotica.tex for usage example(s)
+
+\startmodule[domotica-settings]
+
+\registerctxluafile{s-domotica-settings}{}
+
+% \installmodulecommandluasingle \showopenzwavesettings {.....}
+
+\stopmodule
diff --git a/tex/context/modules/mkiv/s-fonts-coverage.mkiv b/tex/context/modules/mkiv/s-fonts-coverage.mkiv
index c09d943bc..305bb9b7b 100644
--- a/tex/context/modules/mkiv/s-fonts-coverage.mkiv
+++ b/tex/context/modules/mkiv/s-fonts-coverage.mkiv
@@ -38,6 +38,9 @@
[list={texgyrepagella-regular.otf,texgyretermes-regular.otf,texgyrebonum-regular.otf},
pattern=ogonek]
+% \showfontcomparison
+% [list={texgyrepagella-regular.otf,texgyretermes-regular.otf,nimbusroman-regular.afm}]
+
\page
% $e=mc²$ ${}²$ $²$ $x²ᶞ$ $x⁽²⁺²⁼²⁺²⁾$ $x²⁺²⁼²⁺²$ $x₅²$ $x²₅²$
diff --git a/tex/context/modules/mkiv/s-fonts-emoji.mkiv b/tex/context/modules/mkiv/s-fonts-emoji.mkiv
new file mode 100644
index 000000000..59fdda124
--- /dev/null
+++ b/tex/context/modules/mkiv/s-fonts-emoji.mkiv
@@ -0,0 +1,331 @@
+%D \module
+%D [ file=s-fonts-emoji,
+%D version=2017.04.26,
+%D title=\CONTEXT\ Style File,
+%D subtitle=Emoji Helpers,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+\startluacode
+moduledata.emoji = moduledata.emoji or { }
+
+local find = string.find
+local sortedhash = table.sortedhash
+local utfvalues = string.utfvalues
+
+local context = context
+
+local traverse_id = node.traverse_id
+local glyph_code = nodes.nodecodes.glyph
+
+local descriptions = fonts.hashes.descriptions
+local checkedemoji = fonts.symbols.emoji.checked
+local compactemoji = characters.emoji.compact
+local resolvedemoji = characters.emoji.resolve
+local knownemoji = characters.emoji.known
+
+local function emojisnippets(name)
+ local d = descriptions[true]
+ if d then
+ local e = resolvedemoji(name)
+ local s = { }
+ for b in utfvalues(e) do
+ if not (b == 0x200D or (b >= 0x1F3FB and b <= 0x1F3FF)) then
+ local t = { }
+ s[#s+1] = t
+ local c = d[b]
+ if c then
+ c = c.colors
+ if c then
+ for i=1,#c do
+ t[#t+1] = c[i].slot
+ end
+ else
+ t[#t+1] = b
+ end
+ end
+ end
+ end
+ return #s > 0 and s or nil
+ end
+end
+
+local function emojiglyphs(name)
+ local d = descriptions[true]
+ if d then
+ local e = checkedemoji(name)
+ local s = { }
+ for n in traverse_id(glyph_code,e) do
+ local b = n.char
+ if not (b == 0x200D or (b >= 0x1F3FB and b <= 0x1F3FF)) then
+ local t = { }
+ s[#s+1] = t
+ local c = d[b]
+ if c then
+ c = c.colors
+ if c then
+ for i=1,#c do
+ t[#t+1] = c[i].slot
+ end
+ else
+ t[#t+1] = b
+ end
+ end
+ end
+ end
+ nodes.flush_list(e)
+ return #s > 0 and s or nil
+ end
+end
+
+characters.emojisnippets = emojisnippets
+fonts.symbols.emojiglyphs = emojiglyphs
+
+function moduledata.emoji.showsnippets(name)
+ local s = emojisnippets(name)
+ if s then
+ local ni = #s
+ for i=1,ni do
+ local si = s[i]
+ local nj = #si
+ for j=1,nj do
+ context.WrapEmojiSnippet(i,ni,j,nj,si[j])
+ end
+ end
+ end
+end
+
+function moduledata.emoji.showglyphs(name)
+ local s = emojiglyphs(name)
+ if s then
+ local ni = #s
+ for i=1,ni do
+ local si = s[i]
+ local nj = #si
+ for j=1,nj do
+ context.WrapEmojiSnippet(i,ni,j,nj,si[j])
+ end
+ end
+ end
+end
+
+function moduledata.emoji.showknown(list)
+ local hash = knownemoji()
+ local size = 0
+ if list then
+ list = utilities.parsers.settings_to_array(list)
+ size = #list
+ if size == 0 then
+ list = false
+ else
+ for i=1,size do
+ list[i] = string.escapedpattern(list[i])
+ end
+ end
+ end
+ for k, v in sortedhash(hash) do
+ local okay = true
+ if find(compactemoji(k),"%-s%-t") then
+ okay = false
+ elseif list then
+ okay = false
+ for i=1,size do
+ if find(k,list[i]) then
+ okay = true
+ break
+ end
+ end
+ end
+ if okay then
+ context("\\WrapEmojiPlusText{%s}{%!tex!}",k,v)
+ end
+ end
+end
+
+local function convert(t,k)
+ local v = { }
+ for i=1,#k do
+ local p = k[i]
+ end
+ return v
+end
+
+function moduledata.emoji.showpalette(list)
+ local colorpalettes = fonts.hashes.resources[true].colorpalettes
+ if colorpalettes then
+ if list then
+ list = utilities.parsers.settings_to_hash(list)
+ if not next(list) then
+ list = false
+ end
+ end
+ context.starttabulate { "||lp|" }
+ for i=1,#colorpalettes do
+ if not list or list[tostring(i)] then
+ local palette = colorpalettes[i]
+ context.BC()
+ context.type(i)
+ context.NC()
+ for j=1,#palette do
+ local p = palette[j]
+ local r, g, b = p[1]/255, p[2]/255, p[3]/255
+ local s = attributes.colors.rgbtogray(r,g,b)
+ context.WrapEmojiColorEntry(j,s,r,g,b)
+ end
+ context.NC()
+ context.NR()
+ end
+ end
+ context.stoptabulate()
+ end
+end
+
+\stopluacode
+
+\unexpanded\def\WrapEmojiPlusText#1#2%
+ {\dontleavehmode\hbox\bgroup
+ \tttf % determines em
+ \hpack to 8\emwidth{\setfontid\scratchcounter#2\hss}%
+ \hpack to 8\emwidth{\setfontid\scratchcounter\checkedemoji{#1}\hss}%
+ #1%
+ \egroup\par}
+
+\unexpanded\def\ShowEmoji
+ {\dosingleempty\doShowEmoji}
+
+\unexpanded\def\doShowEmoji[#1]%
+ {\begingroup
+ \scratchcounter\fontid\font
+ \ctxlua{moduledata.emoji.showknown([[#1]])}%
+ \endgroup}
+
+\unexpanded\def\WrapEmojiSnippet#1#2#3#4#5%
+ {\ifnum#3=\plusone
+ \par
+ \dontleavehmode\ruledhbox\bgroup
+ \fi
+ \ruledhbox to 2\emwidth{\hss\char#5\hss}%
+ \ifnum#3=#4\relax
+ \egroup
+ \par
+ \fi}
+
+\unexpanded\def\ShowEmojiSnippets[#1]%
+ {\ctxlua{moduledata.emoji.showsnippets("#1")}}
+
+\unexpanded\def\ShowEmojiGlyphs[#1]%
+ {\ctxlua{moduledata.emoji.showglyphs("#1")}}
+
+\unexpanded\def\OverlayEmojiSnippet#1#2#3#4#5%
+ {\setbox\scratchbox\hbox{\color[trace:#3]{\char#5}}%
+ \ifnum#3=\plusone
+ \ifnum#1=\plusone
+ \dontleavehmode\ruledhbox\bgroup
+ \fi
+ \hbox\bgroup
+ \else
+ \hskip-\wd\scratchbox
+ \fi
+ \box\scratchbox
+ \ifnum#3=#4\relax
+ \egroup
+ \ifnum#1=#2\relax
+ \egroup
+ \fi
+ \fi}
+
+\unexpanded\def\ShowEmojiSnippetsOverlay[#1]%
+ {\begingroup
+ \let\WrapEmojiSnippet\OverlayEmojiSnippet
+ \ctxlua{moduledata.emoji.showsnippets("#1")}%
+ \endgroup}
+
+\unexpanded\def\WrapEmojiColorEntry#1#2#3#4#5%
+ {\dontleavehmode\hpack\bgroup
+ \definecolor
+ [dummy]
+ [r=#3,g=#4,b=#5]%
+ \backgroundline
+ [dummy]
+ {\setbox\scratchbox\hpack to 2\emwidth{\hss\ifdim#2pt<.5pt\white\fi\ttx#1\hss}%
+ \ht\scratchbox.8\strutht\dp\scratchbox.6\strutdp\box\scratchbox}%
+ \egroup
+ \quad}
+
+\unexpanded\def\ShowEmojiPalettes
+ {\dosingleempty\doShowEmojiPalettes}
+
+\unexpanded\def\doShowEmojiPalettes[#1]%
+ {\ctxlua{moduledata.emoji.showpalette([[#1]])}}
+
+% \definefontfeature[bandw:overlay][ccmp=yes,dist=yes]
+% \definefontfeature[color:overlay][ccmp=yes,dist=yes,colr=yes]
+% %definefontfeature[bandw:svg] [ccmp=yes,dist=yes]
+% \definefontfeature[color:svg] [ccmp=yes,dist=yes,svg=yes]
+% %definefontfeature[bandw:bitmap] [ccmp=yes,dist=yes,sbix=yes]
+% \definefontfeature[color:bitmap] [ccmp=yes,dist=yes,sbix=yes]
+
+\definefontfeature[seguiemj-cl][color:overlay]
+\definefontfeature[seguiemj-bw][bandw:overlay]
+
+% \definefont[MyEmoji] [seguiemj*seguiemj-bw]
+% \definefont[MyEmoji] [seguiemj*seguiemj-cl]
+% \definefont[MyEmoji] [emojionecolor-svginot*default,svg]
+% \definefont[MyEmoji] [emojionemozilla*default,overlay]
+% \definefont[MyEmoji] [applecoloremoji*default,bitmap]
+
+% \definecolor[trace:1][s=0,t=.5,a=1]
+% \definecolor[trace:2][s=0,t=.5,a=1]
+% \definecolor[trace:3][s=0,t=.5,a=1]
+% \definecolor[trace:4][s=0,t=.5,a=1]
+% \definecolor[trace:5][s=0,t=.5,a=1]
+% \definecolor[trace:6][s=0,t=.5,a=1]
+
+\continueifinputfile{s-fonts-emoji.mkiv}
+
+\starttext
+
+\start
+
+\definedfont[seguiemj*seguiemj-cl]
+
+\ShowEmojiSnippets
+ [family man light skin tone woman dark skin tone girl medium skin tone boy medium skin tone]
+
+\ShowEmojiSnippetsOverlay
+ [family man light skin tone woman dark skin tone girl medium skin tone boy medium skin tone]
+
+\ShowEmojiGlyphs
+ [family man light skin tone woman dark skin tone girl medium skin tone boy medium skin tone]
+
+\page
+
+\ShowEmoji[^man]
+
+\page
+
+\definecolor[emoji-base][r=.4]
+\definecolor[emoji-gray][s=.5,t=.5,a=1]
+
+\definefontcolorpalette
+ [emoji-gray]
+ [emoji-base,emoji-gray]
+
+\definefontfeature[seguiemj-cl][ccmp=yes,dist=yes,colr=emoji-gray]
+
+\definedfont[seguiemj*seguiemj-cl]
+
+\ShowEmoji
+
+\page
+
+\ShowEmojiPalettes[1]
+
+\stop
+
+\stoptext
diff --git a/tex/context/modules/mkiv/s-fonts-features.lua b/tex/context/modules/mkiv/s-fonts-features.lua
index 0a7cf8b13..6f4032948 100644
--- a/tex/context/modules/mkiv/s-fonts-features.lua
+++ b/tex/context/modules/mkiv/s-fonts-features.lua
@@ -13,6 +13,10 @@ moduledata.fonts.features = moduledata.fonts.features or { }
local sortedhash = table.sortedhash
+local v_yes = interfaces.variables.yes
+local v_no = interfaces.variables.no
+local c_name = interfaces.constants.name
+
local NC, NR, bold = context.NC, context.NR, context.bold
function moduledata.fonts.features.showused(specification)
@@ -49,12 +53,12 @@ function moduledata.fonts.features.showused(specification)
elseif rawget(descriptions,feature) then
NC() context(feature)
NC() context("+") -- extra
- NC() context(descriptions[feature])
+ NC() context.escaped(descriptions[feature])
done = true
elseif rawget(features,feature) then
NC() context(feature)
NC() -- otf
- NC() context(features[feature])
+ NC() context.escaped(features[feature])
done = true
else
NC() context(feature)
@@ -83,6 +87,51 @@ local function collectkerns(tfmdata,feature)
local lookuphash = resources.lookuphash
local feature = feature or "kern"
if sequences then
+
+ if true then
+
+ for i=1,#sequences do
+ local sequence = sequences[i]
+ if sequence.features and sequence.features[feature] then
+ local steps = sequence.steps
+ for i=1,#steps do
+ local step = steps[i]
+ local format = step.format
+ for unicode, hash in table.sortedhash(step.coverage) do
+ local kerns = combinations[unicode]
+ if not kerns then
+ kerns = { }
+ combinations[unicode] = kerns
+ end
+ for otherunicode, kern in table.sortedhash(hash) do
+ if format == "pair" then
+ local f = kern[1]
+ local s = kern[2]
+ if f then
+ if s then
+ -- todo
+ else
+ if not kerns[otherunicode] and f[3] ~= 0 then
+ kerns[otherunicode] = f[3]
+ end
+ end
+ elseif s then
+ -- todo
+ end
+ elseif format == "kern" then
+ if not kerns[otherunicode] and kern ~= 0 then
+ kerns[otherunicode] = kern
+ end
+ end
+ end
+ end
+ end
+ end
+ end
+ end
+
+ else -- old loader
+
for i=1,#sequences do
local sequence = sequences[i]
if sequence.features and sequence.features[feature] then
@@ -107,7 +156,9 @@ local function collectkerns(tfmdata,feature)
end
end
end
+
end
+
return combinations
end
@@ -142,6 +193,7 @@ function moduledata.fonts.features.showallkerns(specification)
local tfmdata = fonts.hashes.identifiers[id]
local allkerns = collectkerns(tfmdata)
local characters = tfmdata.characters
+ local hfactor = tfmdata.parameters.hfactor
if next(allkerns) then
for first, pairs in sortedhash(allkerns) do
context.par()
@@ -150,7 +202,7 @@ function moduledata.fonts.features.showallkerns(specification)
-- if not kerns and pairs[second] then
-- -- weird
-- end
- showkernpair(first,kern,second,0)
+ showkernpair(first,kern*hfactor,second)
end
context.par()
end
@@ -159,3 +211,22 @@ function moduledata.fonts.features.showallkerns(specification)
context.par()
end
end
+
+function moduledata.fonts.features.showfeatureset(specification)
+ specification = interfaces.checkedspecification(specification)
+ local name = specification[c_name]
+ if name then
+ local s = fonts.specifiers.contextsetups[name]
+ if s then
+ local t = table.copy(s)
+ t.number = nil
+ if t and next(t) then
+ context.starttabulate { "|T|T|" }
+ for k, v in sortedhash(t) do
+ NC() context(k) NC() context(v == true and v_yes or v == false and v_no or tostring(v)) NC() NR()
+ end
+ context.stoptabulate()
+ end
+ end
+ end
+end
diff --git a/tex/context/modules/mkiv/s-fonts-features.mkiv b/tex/context/modules/mkiv/s-fonts-features.mkiv
index b81b53a71..2dca059ff 100644
--- a/tex/context/modules/mkiv/s-fonts-features.mkiv
+++ b/tex/context/modules/mkiv/s-fonts-features.mkiv
@@ -18,12 +18,13 @@
\installmodulecommandluasingle \showusedfeatures {moduledata.fonts.features.showused}
\installmodulecommandluasingle \showallkerns {moduledata.fonts.features.showallkerns}
\installmodulecommandluasingle \showbasekerns {moduledata.fonts.features.showbasekerns}
+\installmodulecommandluasingle \showfeatureset {moduledata.fonts.features.showfeatureset}
-\def\kernpairheight{\strutheight}
-\def\kernpairdepth {\strutdepth}
+\def\kernpairheight{.8\strutht}
+\def\kernpairdepth {.8\strutdp}
\def\kernpairwidth {\onepoint}
-\unexpanded\def\showkernpair#1#2#3% first second kern
+\unexpanded\def\showkernpair#1#2#3% first kern second
{\dontleavehmode
\hbox \bgroup
\scratchdimen#2\scaledpoint
diff --git a/tex/context/modules/mkiv/s-fonts-missing.lua b/tex/context/modules/mkiv/s-fonts-missing.lua
index 9a75676a9..7db5c2fb8 100644
--- a/tex/context/modules/mkiv/s-fonts-missing.lua
+++ b/tex/context/modules/mkiv/s-fonts-missing.lua
@@ -10,8 +10,7 @@ moduledata.fonts = moduledata.fonts or { }
moduledata.fonts.missing = moduledata.fonts.missing or { }
local function legend(id)
- local c = fonts.hashes.identifiers[id]
- local privates = c.properties.privates
+ local privates = fonts.helpers.getprivates(id)
if privates then
local categories = table.swapped(fonts.loggers.category_to_placeholder)
context.starttabulate { "|c|l|" }
diff --git a/tex/context/modules/mkiv/s-fonts-shapes.lua b/tex/context/modules/mkiv/s-fonts-shapes.lua
index 8f872e4bc..ebdf04c22 100644
--- a/tex/context/modules/mkiv/s-fonts-shapes.lua
+++ b/tex/context/modules/mkiv/s-fonts-shapes.lua
@@ -113,11 +113,8 @@ local function showglyphshape(specification)
local tfmdata = fontdata[id]
local charnum = tonumber(specification.character)
if not charnum then
- charnum = fonts.helpers.nametoslot(n)
+ charnum = fonts.helpers.nametoslot(specification.character)
end
- context.start()
- context.dontleavehmode()
- context.obeyMPboxdepth()
local characters = tfmdata.characters
local descriptions = tfmdata.descriptions
local parameters = tfmdata.parameters
@@ -130,6 +127,9 @@ local function showglyphshape(specification)
local width, italic = (d.width or 0)*factor, (d.italic or 0)*factor
local top_accent, bot_accent = (d.top_accent or 0)*factor, (d.bot_accent or 0)*factor
local anchors, math = d.anchors, d.math
+ context.start()
+ context.dontleavehmode()
+ context.obeyMPboxdepth()
context.startMPcode()
context("numeric lw ; lw := .125bp ;")
context("pickup pencircle scaled lw ;")
@@ -143,7 +143,7 @@ local function showglyphshape(specification)
if #v > 0 then
local l = { }
for kk, vv in ipairs(v) do
- local h, k = vv.height, vv.kern
+ local h, k = vv.height or 0, vv.kern or 0
if h and k then
l[#l+1] = formatters["((%s,%s) shifted (%s,%s))"](xsign*k*factor,ysign*h*factor,dx,dy)
end
@@ -160,7 +160,7 @@ local function showglyphshape(specification)
if #v > 0 then
local l = { }
for kk, vv in ipairs(v) do
- local h, k = vv.height, vv.kern
+ local h, k = vv.height or 0, vv.kern or 0
if h and k then
l[#l+1] = formatters["((%s,%s) shifted (%s,%s))"](xsign*k*factor,ysign*h*factor,dx,dy)
end
@@ -171,7 +171,7 @@ local function showglyphshape(specification)
context('label.%s("\\type{%s}",%s shifted (0,2bp)) ;',loc,txt,l[1])
end
for kk, vv in ipairs(v) do
- local h, k = vv.height, vv.kern
+ local h, k = vv.height or 0, vv.kern or 0
if h and k then
context('label.top("(%s,%s)",%s shifted (0,-2bp));',k,h,l[kk])
end
@@ -183,13 +183,13 @@ local function showglyphshape(specification)
if kerns then
for _, slant in ipairs { slant_1, slant_2 } do
for k,v in pairs(kerns) do
- if k == "top_right" then
+ if k == "topright" then
slant(v,width+italic,0,k,1,1,"top","ulft")
- elseif k == "bottom_right" then
+ elseif k == "bottomright" then
slant(v,width,0,k,1,1,"bot","lrt")
- elseif k == "top_left" then
+ elseif k == "topleft" then
slant(v,0,0,k,-1,1,"top","ulft")
- elseif k == "bottom_left" then
+ elseif k == "bottomleft" then
slant(v,0,0,k,-1,1,"bot","lrt")
end
end
@@ -257,6 +257,7 @@ local function showglyphshape(specification)
context("setbounds currentpicture to boundingbox currentpicture enlarged 1bp ;")
context("currentpicture := currentpicture scaled 8 ;")
context.stopMPcode()
+ context.stop()
-- elseif c then
-- lastdata, lastunicode = nil, nil
-- local factor = (7200/7227)/65536
@@ -290,10 +291,9 @@ local function showglyphshape(specification)
-- context("currentpicture := currentpicture scaled 8 ;")
-- context.stopMPcode()
else
- lastdata, lastunicode = nil, nil
- context("no such shape: 0x%05X",charnum)
+ -- lastdata, lastunicode = nil, nil
+ -- context("no such shape: 0x%05X",charnum)
end
- context.stop()
end
moduledata.fonts.shapes.showglyphshape = showglyphshape
diff --git a/tex/context/modules/mkiv/s-fonts-shapes.mkiv b/tex/context/modules/mkiv/s-fonts-shapes.mkiv
index c1e9d61d2..4a0377ada 100644
--- a/tex/context/modules/mkiv/s-fonts-shapes.mkiv
+++ b/tex/context/modules/mkiv/s-fonts-shapes.mkiv
@@ -11,12 +11,14 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
+%D I will redo this module (using outlines).
+
\startmodule[fonts-shapes]
\registerctxluafile{s-fonts-shapes}{}
\installmodulecommandluasingle \showfontshapes {moduledata.fonts.shapes.showlist}
-\installmodulecommandluasingle \showglyphshape {moduledata.fonts.shapes.showglypshape}
+\installmodulecommandluasingle \showglyphshape {moduledata.fonts.shapes.showglyphshape}
\installmodulecommandluatwo \showlastglyphshapefield {moduledata.fonts.shapes.showlastglyphshapefield}
\installmodulecommandluasingle \showallglyphshapes {moduledata.fonts.shapes.showallglypshapes}
@@ -107,9 +109,10 @@
% \startTEXpage[offset=0pt]\ShowGlyphShape{name:cambria-math}{50bp}{0x1D45D}\stopTEXpage
% \page
- % \showallglyphshapes[name=name:cambria-math,size=100bp]
+\showallglyphshapes[name=name:cambria-math,size=100bp]
% \showallglyphshapes[name=name:dejavuserif,size=100bp]
-\showallglyphshapes[name=file:brill.otf,size=100bp]
+% \showallglyphshapes[name=file:brill.otf,size=100bp]
+% \showallglyphshapes[name=file:minionmath-regular.otf,size=100bp]
\stoptext
diff --git a/tex/context/modules/mkiv/s-fonts-variable.lua b/tex/context/modules/mkiv/s-fonts-variable.lua
new file mode 100644
index 000000000..43f5f0d3d
--- /dev/null
+++ b/tex/context/modules/mkiv/s-fonts-variable.lua
@@ -0,0 +1,313 @@
+if not modules then modules = { } end modules ['s-fonts-variable'] = {
+ version = 1.001,
+ comment = "companion to s-fonts-variable.mkiv",
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "see context related readme files"
+}
+
+moduledata.fonts = moduledata.fonts or { }
+moduledata.fonts.variable = moduledata.fonts.variable or { }
+
+local format = string.format
+local stripstring = string.nospaces
+local lower = string.lower
+local rep = string.rep
+
+local context = context
+local NC, NR, HL, ML = context.NC, context.NR, context.HL, context.ML
+local bold, monobold, mono, formattedmono = context.bold, context.monobold, context.mono, context.formatted.mono
+
+local show_glyphs = false trackers.register("modules.fonts.variables.glyphs", function(v) show_glyphs = v end)
+local show_kerns = false trackers.register("modules.fonts.variables.kerns", function(v) show_kerns = v end)
+
+function moduledata.fonts.variable.showvariations(specification)
+
+ specification = interfaces.checkedspecification(specification)
+
+ local fontfile = specification.font
+ local maximum = tonumber(specification.max) or 0xFFFF
+ local fontname = format("testfont-%s",i)
+ local fontsize = tex.dimen.bodyfontsize
+ if not fontfile then
+ return
+ end
+ local id, fontdata = fonts.definers.define {
+ name = fontfile,
+ -- size = fontsize,
+ cs = fontname,
+ }
+
+ if not fontdata then
+ context.type("no font with name %a found",fontname)
+ return
+ end
+
+ local resources = fontdata.resources
+
+ if not resources then
+ return
+ end
+
+ local variabledata = resources.variabledata or { }
+
+-- if not variabledata then
+-- return
+-- end
+
+if not fontdata.shared.rawdata.metadata.fullname then
+ fontdata.shared.rawdata.metadata.fullname = fontdata.shared.rawdata.metadata.fontname
+end
+
+ context.starttitle { title = fontdata.shared.rawdata.metadata.fullname }
+
+ local parameters = fontdata.parameters
+
+ context.startsubject { title = "parameters" }
+ if parameters then
+ context.starttabulate { "|||" }
+ NC() monobold("ascender") NC() context("%p",parameters.ascender) NC() NR()
+ NC() monobold("descender") NC() context("%p",parameters.descender) NC() NR()
+ NC() monobold("emwidth") NC() context("%p",parameters.em) NC() NR()
+ NC() monobold("exheight") NC() context("%p",parameters.ex) NC() NR()
+ NC() monobold("size") NC() context("%p",parameters.size) NC() NR()
+ NC() monobold("slant") NC() context("%s",parameters.slant) NC() NR()
+ NC() monobold("space") NC() context("%p",parameters.space) NC() NR()
+ NC() monobold("shrink") NC() context("%p",parameters.spaceshrink) NC() NR()
+ NC() monobold("stretch") NC() context("%p",parameters.spacestretch) NC() NR()
+ NC() monobold("units") NC() context("%s",parameters.units) NC() NR()
+ context.stoptabulate()
+ else
+ context("no parameters")
+ end
+ context.stopsubject()
+
+ local features = fontdata.shared.rawdata.resources.features
+
+ context.startsubject { title = "features" }
+ if features then
+ local function f(g)
+ if g then
+ local t = table.sortedkeys(g)
+ local n = 0
+ for i=1,#t do
+ if #t[i] <= 4 then
+ n = n + 1
+ t[n] = t[i]
+ end
+ end
+ return table.concat(t," ",1,n)
+ end
+ end
+ context.starttabulate { "||p|" }
+ NC() monobold("gpos") NC() mono(f(features.gpos)) NC() NR()
+ NC() monobold("gsub") NC() mono(f(features.gsub)) NC() NR()
+ context.stoptabulate()
+ else
+ context("no features")
+ end
+ context.stopsubject()
+
+ local designaxis = variabledata.designaxis
+
+ context.startsubject { title = "design axis" }
+ if designaxis then
+ context.starttabulate { "||||c|c|c|c|c|" }
+ NC() bold("tag")
+ NC() bold("name")
+ NC() bold("variant")
+ NC() bold("flags")
+ NC() bold("value")
+ NC() bold("min")
+ NC() bold("max")
+ NC() bold("link")
+ NC() NR()
+ HL()
+ for k=1,#designaxis do
+ local axis = designaxis[k]
+ local tag = axis.tag
+ local name = axis.name
+ local variants = axis.variants
+ local first = variants and variants[1]
+ if first then
+ local haslimits = first.maximum
+ local haslink = first.link
+ for i=1,#variants do
+ local variant = variants[i]
+ NC() monobold(tag)
+ NC() context(name)
+ NC() context(variant.name)
+ NC() formattedmono("0x%04x",variant.flags)
+ NC() context(variant.value)
+ NC() context(variant.minimum or "-")
+ NC() context(variant.maximum or "-")
+ NC() context(variant.link or "-")
+ NC() NR()
+ tag = nil
+ name = nil
+ end
+ end
+ end
+ context.stoptabulate()
+ else
+ context("no design axis defined (no \\type{stat} table)")
+ end
+ context.stopsubject()
+
+ local axis = variabledata.axis
+ local instances = variabledata.instances
+ local list = { }
+
+ context.startsubject { title = "axis" }
+ if axis then
+ context.starttabulate { "|||c|c|c|" }
+ NC() bold("tag")
+ NC() bold("name")
+ NC() bold("min")
+ NC() bold("def")
+ NC() bold("max")
+ NC() NR()
+ HL()
+ for k=1,#axis do
+ local a = axis[k]
+ NC() monobold(a.tag)
+ NC() context(a.name)
+ NC() context(a.minimum)
+ NC() context(a.default)
+ NC() context(a.maximum)
+ NC() NR()
+ list[#list+1] = a.tag
+ end
+ context.stoptabulate()
+ else
+ context("no axis defined, incomplete \\type{fvar} table")
+ end
+ context.stopsubject()
+
+ local collected = { }
+
+ context.startsubject { title = "instances" }
+ if not instances or #instances == 0 or not list or #list == 0 then
+ context("no instances defined, incomplete \\type{fvar}/\\type{stat} table")
+ else
+ if #axis > 8 then
+ context.start()
+ context.switchtobodyfont { "small" }
+ if #axis > 12 then
+ context.switchtobodyfont { "small" }
+ end
+ end
+ context.starttabulate { "||" .. rep("c|",#list) .. "|" }
+ NC()
+ for i=1,#list do
+ NC() monobold(list[i])
+ end
+ NC()
+ local fullname = lower(stripstring(fontdata.shared.rawdata.metadata.fullname))
+ formattedmono("%s*",fullname)
+ NC() NR()
+ ML()
+ for k=1,#instances do
+ local i = instances[k]
+ NC() monobold(i.subfamily)
+ local values = i.values
+ local hash = { }
+ for k=1,#values do
+ local v = values[k]
+ hash[v.axis] = v.value
+ end
+ for i=1,#list do
+ NC() context(hash[list[i]])
+ end
+ NC()
+ local instance = lower(stripstring(i.subfamily))
+ mono(instance)
+ collected[#collected+1] = fullname .. instance
+ NC() NR()
+ end
+ context.stoptabulate()
+ if #axis > 8 then
+ context.stop()
+ end
+ end
+ context.stopsubject()
+
+ local sample = specification.sample
+
+ for i=1,#collected do
+
+ local instance = collected[i]
+ context.startsubject { title = instance }
+ context.start()
+ context.definedfont { "name:" .. instance .. "*default" }
+ context.start()
+ if show_glyphs then
+ context.showglyphs()
+ end
+ if show_kerns then
+ context.showfontkerns()
+ end
+ if sample and sample ~= "" then
+ context(sample)
+ else
+ context.input("zapf.tex")
+ end
+ context.stop()
+ context.blank { "big,samepage"}
+ context.showfontspacing()
+ context.par()
+ context.stop()
+ context.stopsubject()
+
+ if i > maximum then
+ context.startsubject { title = "And so on" }
+ context("no more than %i instances are shown",maximum)
+ context.par()
+ context.stopsubject()
+ break
+ end
+ end
+
+ -- local function showregions(tag)
+ --
+ -- local regions = variabledata[tag]
+ --
+ -- context.startsubject { title = tag }
+ -- if regions then
+ -- context.starttabulate { "|r|c|r|r|r|" }
+ -- NC() bold("n")
+ -- NC() bold("axis")
+ -- NC() bold("start")
+ -- NC() bold("peak")
+ -- NC() bold("stop")
+ -- NC() NR()
+ -- HL()
+ -- local designaxis = designaxis or axis
+ -- for i=1,#regions do
+ -- local axis = regions[i]
+ -- for j=1,#axis do
+ -- local a = axis[j]
+ -- NC() monobold(i)
+ -- NC() monobold(designaxis[j].tag)
+ -- NC() context("%0.3f",a.start)
+ -- NC() context("%0.3f",a.peak)
+ -- NC() context("%0.3f",a.stop)
+ -- NC() NR()
+ -- i = nil
+ -- end
+ -- end
+ -- context.stoptabulate()
+ -- else
+ -- context("no %s defined",tag)
+ -- end
+ -- context.stopsubject()
+ --
+ -- end
+ --
+ -- showregions("gregions")
+ -- showregions("mregions")
+ -- showregions("hregions")
+
+ context.stoptitle()
+
+end
diff --git a/tex/context/modules/mkiv/s-fonts-variable.mkiv b/tex/context/modules/mkiv/s-fonts-variable.mkiv
new file mode 100644
index 000000000..64348b324
--- /dev/null
+++ b/tex/context/modules/mkiv/s-fonts-variable.mkiv
@@ -0,0 +1,111 @@
+%D \module
+%D [ file=s-fonts-variable,
+%D version=2017.02.18,
+%D title=\CONTEXT\ Style File,
+%D subtitle=Show Variable Font Properties ,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+% begin info
+%
+% title : variable information (experimental)
+%
+% comment : variable fonts contain extra information styles, axis, regions
+% status : experimental, used for luatex testing
+%
+% end info
+
+\startmodule[fonts-variable]
+
+\registerctxluafile{s-fonts-variable}{}
+
+\installmodulecommandluasingle \showfontvariations {moduledata.fonts.variable.showvariations}
+
+\unexpanded\def\showfontspacing
+ {\begingroup
+ \scratchskip \interwordspace plus \interwordstretch minus \interwordshrink
+ \normalexpanded{\hpack\bgroup
+ \tttf
+ sp: \the\scratchskip \hskip\emwidth
+ es: \the\extraspace\hskip\emwidth
+ ex: \the\exheight \hskip\emwidth
+ em: \the\emwidth \hskip\emwidth
+ \egroup}%
+ \endgroup}
+
+\stopmodule
+
+\continueifinputfile{s-fonts-variable.mkiv}
+
+\usemodule[art-01]
+
+\setuphead[section][before={\testpage[5]\blank[2*big]}]
+
+\enabletrackers[modules.fonts.variables.glyphs]
+\enabletrackers[modules.fonts.variables.kerns]
+
+\starttext
+
+ \startbuffer[zycon]
+ \char008986\relax\quad
+ \char009728\relax\quad
+ \char010031\relax\quad
+ \char010143\relax\quad
+ \char011044\relax\quad
+ \char127773\relax\quad
+ \char127989\relax\quad
+ \char128008\relax\quad
+ \char128021\relax\quad
+ \char128034\relax\quad
+ \char128161\relax\quad
+ \char128274\relax\quad
+ \char128347\relax\quad
+ \char128400\relax\quad
+ \char128692\relax\quad
+ \char129417\relax\quad
+ \char129422\relax\quad
+ \char983040\relax\par
+ \stopbuffer
+
+% \showfontvariations
+% [font=file:VotoSerifGX.ttf,
+% max=6]
+
+ \showfontvariations
+ [font=file:adobevfprototype.otf]
+
+ \showfontvariations
+ [font=file:avenirnextvariable.ttf]
+
+ \showfontvariations
+ [font=file:DecoVar-VF.ttf]
+
+ \showfontvariations
+ [font=file:VotoSerifGX.ttf,
+ max=15]
+
+ \showfontvariations
+ [font=file:Selawik-Variable.ttf]
+
+ \showfontvariations
+ [font=file:LibreFranklinGX-Romans.ttf]
+
+ \showfontvariations
+ [font=file:Zycon.ttf,
+ sample={\getbuffer[zycon]}]
+
+ % \showfontvariations
+ % [font=file:kairossansvariable.ttf]
+
+ % \showfontvariations
+ % [font=file:sourcecode-regular.otf]
+
+ % \showfontvariations
+ % [font=file:AmstelvarAlpha-VF.ttf]
+
+\stoptext
diff --git a/tex/context/modules/mkiv/s-inf-01.mkvi b/tex/context/modules/mkiv/s-inf-01.mkvi
index 2c0c1681e..2fda9997a 100644
--- a/tex/context/modules/mkiv/s-inf-01.mkvi
+++ b/tex/context/modules/mkiv/s-inf-01.mkvi
@@ -39,7 +39,7 @@
"colo%-pan.tex", ".*test.*"
}
local types = {
- "tex", "mkii", "mkiv", "mkvi", "lua"
+ "tex", "mkii", "mkiv", "mkvi", "lua", -- "mpiv"
}
local patterns = {
"^([a-z][a-z][a-z][a-z])%-[a-z0-9%-]+%.[a-z]+",
@@ -150,7 +150,7 @@
for k, v in table.sortedpairs(what) do
local c = what == size and comp[k] or nope
context.NC()
- context("%s~%s~~%s~~%s",
+ context("\\bf %s~%s~~%s~~%s",
(used.mkii[k] and "ii") or "~~",
(used.mkiv[k] and "iv") or "~~",
(used.mkvi[k] and "vi") or "~~",
@@ -197,7 +197,7 @@
\starttexdefinition Top #what#fraction#total#bigones
\hbox to 5em{\hss#total}%
\enspace
- \hbox {#what\ifnum#total=#bigones\else~#bigones\rlap{~+}\fi\hss}%
+ \hbox {{\bf#what}\ifnum#total=#bigones\else~#bigones\rlap{~+}\fi\hss}%
\stoptexdefinition
\starttexdefinition Bar #color#size#nobigones#fraction
@@ -225,19 +225,26 @@
\stoptexdefinition
\starttexdefinition Up #color#width
- \scratchdimen#width\dimexpr 16em\relax
+% \scratchdimen#width\dimexpr 16em\relax
+ \scratchdimen#width\dimexpr 40em\relax
\ifdim\scratchdimen=\zeropoint
\kern1em
+ \else\ifdim\scratchdimen>13em
+ \blackrule[color=bar:#color,height=15em,width=1em]%
+ \hskip-1.1em
+ \blackrule[color=white,height=14em,width=1.2em]%
+ \hskip-1.1em
+ \blackrule[color=bar:#color,height=13em,width=1em]%
\else
\ifdim\scratchdimen<\onepoint \scratchdimen\onepoint \fi
\blackrule[color=bar:#color,height=\scratchdimen,width=1em]%
- \fi
+ \fi\fi
\stoptexdefinition
\starttexdefinition Show #title#how#what
\startTEXpage[offset=1em,width=fit]
\hbox{\tttf\strut\currentdate~-~#title}
- \par
+ \blank[line]
\ctxlua{document.context_state_\number#how("#what")}
\stopTEXpage
\stoptexdefinition
@@ -249,7 +256,7 @@
{The number of files used in ConTeXt (base modules and styles).}
{1}{number}
\Show
- {The size of (core) files used in ConTeXt (- indicates exclusion of large data files; + indicates inclusion of large data files; comment and spaces removed.)}
+ {The size of (core) files used in ConTeXt (- : large data files excluded; + : large data files included; comment and spaces removed)}
{1}{size}
\Show
{The relative number of files used in ConTeXt (tex, mkii, mkiv, mkvi, lua).}
diff --git a/tex/context/modules/mkiv/s-inf-03.mkiv b/tex/context/modules/mkiv/s-inf-03.mkiv
index a253bed77..d2acb7341 100644
--- a/tex/context/modules/mkiv/s-inf-03.mkiv
+++ b/tex/context/modules/mkiv/s-inf-03.mkiv
@@ -16,7 +16,7 @@
\definefont
[TitlePageFont]
- [MonoBold at 15pt]
+ [MonoBold at 14pt]
\setupbodyfont
[tt,8pt]
@@ -25,7 +25,7 @@
\definefont
[TitlePageFont]
- [MonoBold at 18pt]
+ [MonoBold at 17pt]
\setupbodyfont
[tt]
@@ -158,13 +158,11 @@ local upper = string.upper
local skipglobal = table.tohash {
"_G", "_M", "_ENV", "",
"context", "modules", "global", "arg", "utf", 1,
- "_ptbs_", "_pcol_", "_plib_", "_clib_", "_tlib_",
- "kpse", "commands",
+ "kpse", "commands", "ffi",
}
local skipkeys = table.tohash {
- "_pcol_", "_plib_", "_clib_", "_tlib_", "_bpnf_", "_ptbs_",
- "_cldf_", "_cldn_", "_cldo_",
+ -- "_cldf_", "_cldn_", "_cldo_",
"_clmb_", "_clme_", "_clmm_", "_clmn_", "_clma_", "_clmh_",
"_G", "_M", "_ENV", "",
-- "global", "shortcuts",
@@ -215,11 +213,10 @@ local function childtables(key,tab,handler,depth)
if marked(v) then
t = "data"
handler(s,t,depth)
+ elseif done[v] then
+ -- logs.report("inf-03","key %a in %a already done",k,v)
else
-if done[v] then
- -- logs.report("inf-03","key %a in %a already done",k,v)
-else
- done[v] = true
+ done[v] = true
handler(s,t,depth)
if variant == 3 then
childtables(false,v,handler,depth+1)
@@ -229,7 +226,6 @@ else
childtables(s,v,handler,depth+1)
end
end
-end
else
handler(s,t,depth)
end
@@ -252,7 +248,7 @@ end
local function show(title,subtitle,alias,builtin,t,lib,libcolor,glo,glocolor,mark,obsolete)
-- todo: table as argument
--- print(title,subtitle,alias,builtin,t,lib,libcolor,glo,glocolor,mark,obsolete)
+ -- print(title,subtitle,alias,builtin,t,lib,libcolor,glo,glocolor,mark,obsolete)
local keys = sortedkeys(t) -- no sorted_pairs
if #keys > 0 then
local fulltitle = title
@@ -269,7 +265,7 @@ local function show(title,subtitle,alias,builtin,t,lib,libcolor,glo,glocolor,mar
end
context.startcolumns { n = 2 }
context.starttabulate { "|||" }
- local t_obsolete = t.obsolete
+ local t_obsolete = rawget(t,"obsolete") -- tricky a t.obsolete fails
if type(t_obsolete) ~= "table" then
t_obsolete = nil
end
diff --git a/tex/context/modules/mkiv/s-languages-frequencies.lua b/tex/context/modules/mkiv/s-languages-frequencies.lua
index 16213a412..4ff5cfe03 100644
--- a/tex/context/modules/mkiv/s-languages-frequencies.lua
+++ b/tex/context/modules/mkiv/s-languages-frequencies.lua
@@ -31,3 +31,7 @@ function moduledata.languages.frequencies.showlist(specification)
end
context.stoptabulate()
end
+
+-- function MP.frqc(language,slot)
+-- mp.print(languages.frequencies.getdata(language).frequencies[slot])
+-- end
diff --git a/tex/context/modules/mkiv/s-languages-hyphenation.lua b/tex/context/modules/mkiv/s-languages-hyphenation.lua
index 971ca3d8f..6d3cf3d3e 100644
--- a/tex/context/modules/mkiv/s-languages-hyphenation.lua
+++ b/tex/context/modules/mkiv/s-languages-hyphenation.lua
@@ -39,6 +39,8 @@ local getdisc = nuts.getdisc
local getattr = nuts.getattr
local getfont = nuts.getfont
local getfield = nuts.getfield
+local getlang = nuts.getlang
+local setlang = nuts.setlang
local setlink = nuts.setlink
local setdisc = nuts.setdisc
local setfield = nuts.setfield
@@ -129,7 +131,7 @@ local function getlanguage(head,l,left,right)
local t = { }
for n in traverse_by_id(glyph_code,tonut(head)) do
t[n] = {
- getfield(n,"lang"),
+ getlang(n),
getfield(n,"left"),
getfield(n,"right"),
}
@@ -148,7 +150,7 @@ function moduledata.languages.hyphenation.showhyphens(head)
-- somehow assigning -1 fails
for n in traverse_by_id(glyph_code,tonut(head)) do
cached[n] = {
- getfield(n,"lang"),
+ getlang(n),
getfield(n,"left"),
getfield(n,"right")
}
@@ -161,7 +163,7 @@ function moduledata.languages.hyphenation.showhyphens(head)
local lmin = s.lefthyphenmin
local rmin = s.righthyphenmin
for n in next, cached do
- setfield(n,"lang",l)
+ setlang(n,l)
setfield(n,"left",lmin)
setfield(n,"right",rmin)
end
@@ -173,7 +175,7 @@ function moduledata.languages.hyphenation.showhyphens(head)
mark(head,marked[i],1/16,l/2,l/4,"hyphenation:"..(colorbytag and tags[i] or i))
end
for n, d in next, cached do
- setfield(n,"lang",d[1])
+ setlang(n,d[1])
setfield(n,"left",d[2])
setfield(n,"right",d[3])
end
diff --git a/tex/context/modules/mkiv/s-mag-01.mkiv b/tex/context/modules/mkiv/s-mag-01.mkiv
new file mode 100644
index 000000000..7191d760c
--- /dev/null
+++ b/tex/context/modules/mkiv/s-mag-01.mkiv
@@ -0,0 +1,505 @@
+%D \module
+%D [ file=s-mag-01,
+%D version=2016.09.12, % mkiv version of 2002.12.14,
+%D title=\CONTEXT\ Style File,
+%D subtitle=\CONTEXT\ Magazine Base Style,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+%D This style is used for producing explanationary documents. Don't misuse it for
+%D other purposes, since it may confuse users. Don't change the title either, since
+%D it provides a way to categorize documents. Numbers are disabled in instances
+%D produced outside PRAGMA ADE.
+%D
+%D The layout setup is such that one has several text areas available: headers and
+%D footers, margins and edges as well as the main text area. The surrounding (gray)
+%D makes the main page stand out and is suitable for viewing in spread mode.
+%D
+%D Since this style is under constant construction, messing around with settings
+%D will produce unwanted side effects. So, if some feature or settings is needed,
+%D let me know.
+
+% These are reserved for PRAGMA-ADE, don't use them yourself!
+
+% \setupdocument[main=Tricky]
+% \setupdocument[main=Update]
+% \setupdocument[main=HOWTO]
+
+% \setupdocument[main=This Way] % preludes to a/the manual
+% \setupdocument[main=A Better Way] % dirty versus clean
+% \setupdocument[main=No Way] % how users should not do it
+% \setupdocument[main=Your Way] % how users do it
+% \setupdocument[main=My Way] % how users do it
+% \setupdocument[main=Our Way] % how we do things at pragma
+% \setupdocument[main=Their Way] % how to do latex things in context
+
+\usemodule[narrowtt,scite]
+
+\definepapersize
+ [magazine]
+ [width=\dimexpr\paperwidth-.1\paperwidth\relax,
+ height=\dimexpr\paperheight-.1\paperheight\relax]
+
+\setuppapersize
+ [magazine]
+ [A4]
+
+\setupinteractionscreen
+ [option=doublesided]
+
+\setupexternalfigures
+ [location={local,default}]
+
+\definecolor[OuterColor][s=.3]
+\definecolor[InnerColor][s=.8]
+\definecolor[MainColor] [s=.2]
+\definecolor[TitleColor][s=.9]
+
+\definecolor[MyRed] [r=.6]
+\definecolor[MyGreen][g=.6]
+\definecolor[MyBlue] [b=.6]
+
+\startreusableMPgraphic{middlepaper}
+ fill OverlayBox
+ withshademethod "circular"
+ withshadecenter center (0.5,0.5)
+ withshadecolors ("InnerColor","OuterColor") ;
+\stopreusableMPgraphic
+
+\startreusableMPgraphic{rightpaper}
+ fill OverlayBox
+ withshademethod "circular"
+ withshadecenter center (0,0.5)
+ withshadecolors ("InnerColor","OuterColor") ;
+\stopreusableMPgraphic
+
+\startreusableMPgraphic{leftpaper}
+ fill OverlayBox
+ withshademethod "circular"
+ withshadecenter center (1,0.5)
+ withshadecolors ("InnerColor","OuterColor") ;
+\stopreusableMPgraphic
+
+\startreusableMPgraphic{page}
+ fill OverlayBox withcolor white ;
+\stopreusableMPgraphic
+
+\startusableMPgraphic{text}
+ StartPage ;
+ for i = Header,Text,Footer :
+ for j = LeftEdge, LeftMargin, Text, RightMargin, RightEdge :
+ draw Field[i][j] withpen pencircle scaled .5pt ;
+ endfor ;
+ endfor ;
+ StopPage ;
+ setbounds currentpicture to Field[Text][Text] ;
+\stopusableMPgraphic
+
+\startsetups[paper]
+
+ \doifmodeelse{*makeup} {
+ \reuseMPgraphic{middlepaper}
+ } {
+ \doifoddpageelse {
+ \reuseMPgraphic{rightpaper}
+ } {
+ \reuseMPgraphic{leftpaper}}
+ }
+
+\stopsetups
+
+\defineoverlay[paper] [\setups{paper}]
+\defineoverlay[page] [\reuseMPgraphic{page}]
+\defineoverlay[text] [\doifmode{frame}{\useMPgraphic{text}}]
+
+\setupbackgrounds [paper] [background=paper]
+\setupbackgrounds [page] [background={page,title}]
+\setupbackgrounds [text] [background=text]
+
+\definelayer
+ [title]
+ [state=repeat,
+ hoffset=-1cm,
+ voffset=1cm,
+ width=\paperwidth,
+ height=\paperheight]
+
+\setuplayout
+ [width=middle,
+ topspace=1.5cm,
+ height=middle,
+ header=1.5cm,
+ footer=1cm,
+ %grid=yes,
+ headerdistance=.25cm,
+ footerdistance=.5cm,
+ backspace=3cm,
+ margin=1.5cm,
+ margindistance=.25cm,
+ edge=.75cm,
+ edgedistance=.25cm,
+ bottomdistance=1.5cm,
+ bottom=.1\printpaperheight]
+
+\definelayout
+ [listing]
+ [backspace=15mm,
+ curspace=15mm]
+
+\definelayout
+ [makeup]
+ [topspace=1cm,
+ backspace=1cm,
+ header=0pt,
+ footer=0pt,
+ bottom=0pt]
+
+\setuppagenumbering
+ [alternative=doublesided]
+
+\setupbodyfont
+ [pagella,10pt]
+
+\setuptolerance
+ [verytolerant,stretch]
+
+\appendtoks
+ \setups[papershift]%
+\to \beforeeverypage
+
+\startsetups[papershift]
+
+ \setuppapersize[top=\vskip.5cm,bottom=\vss]
+
+ \doifmodeelse{*makeup} {
+ \setuppapersize[left=\hfill,right=\hfill]
+ } {
+ \doifoddpageelse {
+ \setuppapersize[right=\hfill]
+ } {
+ \setuppapersize[left=\hfill]
+ }
+ }
+
+\stopsetups
+
+\setupbottomtexts
+ [\setups{rightbanner}] []
+ [] [\setups{leftbanner}]
+
+\startsetups [leftbanner]
+
+ \definedfont[Regular*default at \the\bottomheight]
+
+ \TitleColor
+
+ \setbox\scratchbox\hbox {
+ \documentvariable{main}
+ }
+ \ht\scratchbox\exheight
+ \dp\scratchbox\zeropoint
+
+ \definedfont[Regular*default sa 2]
+ \doifsomething {\documentvariable{number}} {
+ \doifnot {\documentvariable{number}} {0} {
+ \#\documentvariable{number}
+ }
+ }
+ \quad
+ \currentdate
+ \quad
+ \scale
+ [height=.25\bottomheight]
+ {\box\scratchbox}
+ \quad
+ \hbox to 1.5em{\hss\pagenumber\hss}
+ \quad
+ \hskip-\backspace
+
+\stopsetups
+
+\startsetups [rightbanner]
+
+ \definedfont[Regular*default at \the\bottomheight]
+
+ \TitleColor
+
+ \setbox\scratchbox\hbox {
+ \documentvariable{main}
+ }
+ \ht\scratchbox\exheight
+ \dp\scratchbox\zeropoint
+
+ \hskip-\backspace
+ \definedfont[Regular*default sa 2]
+ \quad
+ \hbox to 1.5em{\hss\pagenumber\hss}
+ \quad
+ \scale
+ [height=.25\bottomheight]
+ {\box\scratchbox}
+ \quad
+ \currentdate
+ \quad
+ \doifmode {atpragma} {
+ \#\documentvariable{number}
+ }
+
+\stopsetups
+
+\startsetups[titlepage]
+
+ \disablemode[frame]
+
+ \doifmode {atpragma} {
+ \definecolor[pragmacolor] [r=1,g=.62,b=.06] % (Pantone 138 CV)
+ \definecolor[OuterColor][.3(\documentvariable{color})]
+ }
+
+ \setuplayout[makeup]
+
+ \startstandardmakeup[doublesided=no]
+
+ \dontcomplain
+
+ \definelayer
+ [makeup]
+ [width=\textwidth,
+ height=\textheight]
+
+ \setlayerframed [
+ makeup
+ ] [
+ corner={left,top},
+ location={right,bottom}
+ ] [
+ frame=off,
+ foregroundcolor=MainColor
+ ] {
+ \scale
+ [width=\makeupwidth]
+ {
+ \definedfont[Regular*default sa 10]
+ \documentvariable{main}
+ }
+ }
+
+ \setlayerframed [
+ makeup
+ ] [
+ corner={right,top},
+ location={left},
+ y=.4\textheight
+ ] [
+ frame=off,
+ foregroundcolor=MainColor,
+ width=\textwidth,
+ align=left
+ ] {
+ \definedfont[Regular*default sa 2.5]
+ \setupinterlinespace
+ \startmode[atpragma]
+ \strut \ConTeXt\ magazine \#\documentvariable{number}\endgraf
+ \stopmode
+ \strut \documentvariable{date} \endgraf
+ \blank
+ \strut \documentvariable{title}\endgraf
+ \doifsomething {\documentvariable{author}} {
+ \strut \documentvariable{author}\endgraf
+ }
+ \doifsomething {\documentvariable{affiliation}} {
+ \strut \documentvariable{affiliation}\endgraf
+ }
+ }
+
+ \setlayerframed [
+ makeup
+ ] [
+ corner={right,bottom},
+ location={left,top}
+ ] [
+ frame=off,
+ align=normal,
+ width=.8\textwidth,
+ foregroundcolor=MainColor
+ ] {
+ \getbuffer[abstract]
+ }
+
+ \flushlayer[makeup]
+
+ \stopstandardmakeup
+
+ \setuplayout[reset]
+
+\stopsetups
+
+\startsetups[cleanup]
+
+ \page
+
+ \setuptexttexts
+ [margin]
+ [] []
+
+\stopsetups
+
+\startsetups[listing]
+
+ \page \disablemode[frame]
+
+ \setuptexttexts [][] \setuptexttexts []
+ \setupheadertexts[][] \setupheadertexts[source code of this document]
+ \setupfootertexts[][] \setupfootertexts[]
+
+ \setuplayout[listing]
+
+ \start
+
+ \dontcomplain
+
+ \switchtobodyfont[8pt]
+
+ \scitefile[\jobfilefullname]
+
+ \page
+
+ \stop
+
+ \setuplayout
+
+\stopsetups
+
+\startsetups[lastpage]
+
+ \page \disablemode[frame] \page[even]
+
+ \doifoddpageelse {
+ } {
+ \setuplayout[makeup]
+ \startstandardmakeup[doublesided=no,page=]
+ \stopstandardmakeup
+ \setuplayout[reset]
+ }
+
+\stopsetups
+
+\startsetups[title]
+
+ \disablemode[frame]
+
+ \setlayerframed [
+ title
+ ] [
+ corner={left,top},
+ location={left,bottom},
+ rotation=90
+ ] [
+ frame=off,
+ foregroundcolor=TitleColor
+ ] {
+ \definedfont[RegularBold*default sa 2]
+ \strut\documentvariable{title}
+ }
+
+ \setlayerframed [
+ title
+ ] [
+ corner={right,top},
+ rotation=270
+ ] [
+ frame=off,
+ foregroundcolor=TitleColor
+ ] {
+ \definedfont[RegularBold*default sa 2]
+ \strut\documentvariable{title}
+ }
+
+ \doifsomething {\documentvariable{subtitle}} {
+ \setupheadertexts[\documentvariable{subtitle}]
+ }
+
+\stopsetups
+
+\startbuffer[abstract]
+ % no abstract
+\stopbuffer
+
+\setuphead
+ [chapter]
+ [page=yes,
+ after={\blank[2*big]},
+ color=MainColor,
+ style=\bfc]
+
+\setuphead
+ [section]
+ [before={\blank[2*big]},
+ after=\blank,
+ color=MainColor,
+ style=\bfb]
+
+\setuphead
+ [subsection]
+ [before=\blank,
+ after=,
+ color=MainColor,
+ style=\bf]
+
+\setupwhitespace
+ [big]
+
+\definetyping[xtyping] [style=\ttx]
+\definetyping[xxtyping][style=\ttxx]
+
+\definetyping[ntyping] \setuptyping[ntyping][style=\narrowtt]
+\definetype [ntype] \setuptype [ntype] [style=\narrowtt]
+
+\setupdocument
+ [main={\doifelsemode{atpragma}{This Way}{My Way}},
+ %color=pragmacolor,
+ title={No Title},
+ subtitle=,
+ author={No Author},
+ affiliation=,
+ date={No Date},
+ number=0,
+ before={\setups[titlepage,title]},
+ after={\setups[cleanup,listing,lastpage]}]
+
+\continueifinputfile {s-mag-01.mkiv}
+
+\startbuffer[abstract]
+ This is the zero issue of a semi periodical. The associated style can be used
+ by \CONTEXT\ users to typeset and publish their own issues.
+\stopbuffer
+
+\startdocument
+ [title={Introduction},
+ subtitle={Welcome},
+ author={Hans Hagen},
+ affiliation=PRAGMA ADE,
+ date=Januari 2003,
+ number=0 \MKIV]
+
+This is the zero issue of a range of \CONTEXT\ related publications, in most
+cases short introductions to new functionality. The style may be used by users
+for providing similar documents, but preferably not for other purposes, since it
+may confuse readers in their expectations.
+
+We've chosen a layout which is more functional than beautiful. This layout
+provides several text areas: headers and footers, margins and edges as well as a
+main text area. The surrounding (gray or color) makes the main page (which is
+slightly smaller than A4) stand out and is suitable for viewing in spread mode.
+
+The documents produced at \PRAGMA\ are called {\bf This Way}, user documents gets
+the title {\bf My Way}. The \PRAGMA\ issues are numbered. We strongly advise you
+not to use the \type {mag-} prefix for your issues, since this may lead to
+clashes with files distributed by \PRAGMA.
+
+\stopdocument
diff --git a/tex/context/modules/mkiv/s-math-characters.lua b/tex/context/modules/mkiv/s-math-characters.lua
index 8ff3a8660..757e843da 100644
--- a/tex/context/modules/mkiv/s-math-characters.lua
+++ b/tex/context/modules/mkiv/s-math-characters.lua
@@ -53,8 +53,14 @@ function moduledata.math.characters.showlist(specification)
local sorted = { }
if type(list) == "string" then
sorted = utilities.parsers.settings_to_array(list)
+ for i=1,#sorted do
+ sorted[i] = tonumber(sorted[i])
+ end
elseif type(list) == "table" then
sorted = list
+ for i=1,#sorted do
+ sorted[i] = tonumber(sorted[i])
+ end
elseif fillinthegaps then
sorted = table.keys(characters)
for k, v in next, gaps do
diff --git a/tex/context/modules/mkiv/s-math-characters.mkiv b/tex/context/modules/mkiv/s-math-characters.mkiv
index 3b273cb6c..e5e0d084f 100644
--- a/tex/context/modules/mkiv/s-math-characters.mkiv
+++ b/tex/context/modules/mkiv/s-math-characters.mkiv
@@ -56,8 +56,8 @@
\directsetup{s-math-characters:reset}
- \unexpanded\def\showmathcharactersstartentry {\blank\begingroup\raggedright}
- \unexpanded\def\showmathcharactersstopentry {\endgroup\blank}
+ \unexpanded\def\showmathcharactersstartentry {\blank\startpacked\raggedright}
+ \unexpanded\def\showmathcharactersstopentry {\stoppacked\blank}
\def\showmathcharactersentryhexdectit##1##2##3%
{##1:\space{\char##2}\space\ruledhbox{\char##2}\space##3\par
@@ -177,7 +177,7 @@
% \setupbodyfont[stix, 12pt]
% \setupbodyfont[xits, 12pt]
% \setupbodyfont[lucida, 12pt]
- % \setupbodyfont[lucidanova,12pt]
+ % \setupbodyfont[lucidaot, 12pt]
% \setupbodyfont[pagella, 12pt]
% \setupbodyfont[bonum, 12pt]
diff --git a/tex/context/modules/mkiv/s-math-extensibles.mkiv b/tex/context/modules/mkiv/s-math-extensibles.mkiv
index f9ff8547a..cc6fd1b00 100644
--- a/tex/context/modules/mkiv/s-math-extensibles.mkiv
+++ b/tex/context/modules/mkiv/s-math-extensibles.mkiv
@@ -48,9 +48,9 @@
\def\modulemathextensiblesalternativea#1#2#3%
{\NC U+#1
\NC \filledhboxm{\math{\char"#1}}
- \NC \hbox{\math{\mathextensible[demo]{"#1}{top}{bottom}}}
- \NC \hbox{\math{\mathextensible[demo]{"#1}{}{bottom}}}
- \NC \hbox{\math{\mathextensible[demo]{"#1}{top}{}}}
+ \NC \hbox{\math{\mathstacker[demo]{"#1}{top}{bottom}}}
+ \NC \hbox{\math{\mathstacker[demo]{"#1}{}{bottom}}}
+ \NC \hbox{\math{\mathstacker[demo]{"#1}{top}{}}}
\NC \nohyphens \veryraggedright #2
\NC\NR}
diff --git a/tex/context/modules/mkiv/s-math-repertoire.mkiv b/tex/context/modules/mkiv/s-math-repertoire.mkiv
index 230eb513e..91af45dfc 100644
--- a/tex/context/modules/mkiv/s-math-repertoire.mkiv
+++ b/tex/context/modules/mkiv/s-math-repertoire.mkiv
@@ -13,13 +13,13 @@
\usemodule[s][math-characters]
-% context --jit --global --bodyfont=lucidanova --result=math-repertoire-lucidanova s-math-repertoire.mkiv
-% context --jit --global --bodyfont=cambria --result=math-repertoire-cambria s-math-repertoire.mkiv
-% context --jit --global --bodyfont=xits --result=math-repertoire-xits s-math-repertoire.mkiv
-% context --jit --global --bodyfont=modern --result=math-repertoire-modern s-math-repertoire.mkiv
-% context --jit --global --bodyfont=pagella --result=math-repertoire-pagella s-math-repertoire.mkiv
-% context --jit --global --bodyfont=termes --result=math-repertoire-termes s-math-repertoire.mkiv
-% context --jit --global --bodyfont=bonum --result=math-repertoire-bonum s-math-repertoire.mkiv
+% context --jit --global --bodyfont=lucidaot --result=math-repertoire-lucidaot s-math-repertoire.mkiv
+% context --jit --global --bodyfont=cambria --result=math-repertoire-cambria s-math-repertoire.mkiv
+% context --jit --global --bodyfont=xits --result=math-repertoire-xits s-math-repertoire.mkiv
+% context --jit --global --bodyfont=modern --result=math-repertoire-modern s-math-repertoire.mkiv
+% context --jit --global --bodyfont=pagella --result=math-repertoire-pagella s-math-repertoire.mkiv
+% context --jit --global --bodyfont=termes --result=math-repertoire-termes s-math-repertoire.mkiv
+% context --jit --global --bodyfont=bonum --result=math-repertoire-bonum s-math-repertoire.mkiv
\startmodule[math-repertoire]
@@ -473,7 +473,8 @@
% \setupbodyfont[pagella, 12pt]
% \setupbodyfont[bonum, 12pt]
% \setupbodyfont[schola, 12pt]
- \setupbodyfont[dejavu, 12pt]
+ % \setupbodyfont[dejavu, 12pt]
+ \setupbodyfont[lucidaot, 12pt]
} {
diff --git a/tex/context/modules/mkiv/s-pre-17.mkiv b/tex/context/modules/mkiv/s-pre-17.mkiv
index 9c46b4ed7..558d5afd2 100644
--- a/tex/context/modules/mkiv/s-pre-17.mkiv
+++ b/tex/context/modules/mkiv/s-pre-17.mkiv
@@ -52,10 +52,6 @@
\defineoverlay [blowdown] [{\hboxreference[page:\realfolio]{\overlaybutton{page:\realfolio}}}]
\defineoverlay [forward] [\overlaybutton{forward}]
-\startMPinclusions
- input "mp-abck.mpiv" ;
-\stopMPinclusions
-
\startMPpositiongraphic{mppos:connection}
path pa, pb, pc ; pair ca, cb ;
initialize_box(\MPpos{\MPvar{self}}) ; pa := pxy ; ca := cxy ;
diff --git a/tex/context/modules/mkiv/s-present-balls.mkiv b/tex/context/modules/mkiv/s-present-balls.mkiv
new file mode 100644
index 000000000..6774b8340
--- /dev/null
+++ b/tex/context/modules/mkiv/s-present-balls.mkiv
@@ -0,0 +1,194 @@
+%D \module
+%D [ file=s-present-balls, % s-pre-15,
+%D version=1999.09.01,
+%D title=\CONTEXT\ Style File,
+%D subtitle=Presentation Environment Balls,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+\startmodule[present-balls]
+
+%D This is one of the styles I made for the presentation on the \NTS\ project at
+%D Euro\TeX\ 1998. You need balls to let \TEX\ typeset graphics, but this style
+%D demonstrates that it can be done.
+%D
+%D This presentation is meant for presentations that build up an idea stepwise.
+%D
+%D \starttyping
+%D \TitlePage{Do you know \TEX ?}
+%D
+%D \StartIdea
+%D \StartItem We use \TEX\ for typesetting \unknown \StopItem
+%D \StartItem mathematical text \unknown \StopItem
+%D \StartItem but also for text that has no math \unknown \StopItem
+%D \StartItem or presentations like this \unknown \StopItem
+%D \StartItem and whatever you can come up with! \StopItem
+%D \StopIdea
+%D \stoptyping
+%D
+%D The basic layout is rather simple and used as much of the screen as possible.
+
+\setuppapersize
+ [S6][S6]
+
+\setuplayout
+ [backspace=25pt,
+ topspace=25pt,
+ width=middle,
+ height=middle,
+ header=0pt,
+ footer=0pt]
+
+\setupinteraction
+ [state=start,
+ display=new,
+ color=LineColor,
+ contrastcolor=LineColor,
+ click=no]
+
+\setupinteractionscreen
+ [option=max]
+
+\startmode[asintended,atpragma] \setupbodyfont[lucidaot] \stopmode
+
+\setupbodyfont[14.4pt]
+
+%D We use a lot of color. You can remap them if you want different ones. The ideas
+%D circulate over the colors.
+
+\definecolor[TextColor][s=.8]
+\definecolor[PageColor][s=.6]
+\definecolor[LineColor][s=.4]
+
+\definecolor[red] [r=.4] \definecolor[cyan] [g=.4,b=.4]
+\definecolor[green][g=.4] \definecolor[magenta][r=.4,b=.4]
+\definecolor[blue] [b=.4] \definecolor[yellow] [r=.4,g=.4]
+
+\definecolor[linecolor 1][red] \definecolor[linecolor 5][cyan]
+\definecolor[linecolor 2][green] \definecolor[linecolor 6][magenta]
+\definecolor[linecolor 3][blue] \definecolor[linecolor 4][yellow]
+
+%D We use variables to make sure that the graphics are reused but unique.
+
+\setupMPvariables[pageframe][pagecolor=PageColor,linecolor=LineColor]
+\setupMPvariables[textframe][textcolor=TextColor,linecolor=LineColor]
+
+\setupbackgrounds
+ [page]
+ [background={pageframe,nextpage}]
+
+\defineoverlay [pageframe] [\uniqueMPgraphic{pageframe}]
+\defineoverlay [textframe] [\uniqueMPgraphic{textframe}]
+\defineoverlay [nextpage] [\overlaybutton{forward}]
+
+\startuniqueMPgraphic{pageframe}{pagecolor,linecolor}
+ path p ; p := fullsquare xyscaled (OverlayWidth,OverlayHeight) ;
+ pickup pencircle scaled 10pt ;
+ fill p withcolor \MPvar{pagecolor} ;
+ draw p withcolor \MPvar{linecolor} ;
+\stopuniqueMPgraphic
+
+\startuniqueMPgraphic{textframe}{textcolor,linecolor}
+ path p ; p := fullcircle xyscaled (OverlayWidth,OverlayHeight) ;
+ pickup pencircle scaled 10pt ;
+ fill p withcolor \MPvar{textcolor} ;
+ draw p withcolor \MPvar{linecolor} ;
+\stopuniqueMPgraphic
+
+%D The rest of the file implements the nasty part: typesetting text embedded in a
+%D graphic. The text is collected in a box so that we can reuse it.
+
+\newbox \CollectedIdeas
+\newcount\CurrentTopic
+
+\unexpanded\def\StartItem
+ {\setbox\CollectedIdeas=\hbox\bgroup
+ \ifdim\wd\CollectedIdeas>\zeropoint
+ \unhbox\CollectedIdeas
+ \hskip25pt
+ \fi
+ \setbox\scratchbox=\hbox\bgroup
+ \framed
+ [width=160pt,
+ height=160pt,
+ align=middle,
+ frame=off,
+ background=textframe,
+ offset=15pt,
+ top=\vfill,
+ bottom=\vfill]
+ \bgroup}
+
+\unexpanded\def\StopItem
+ {\egroup
+ \egroup
+ \setbox\scratchbox=\hbox{\lower.5\ht\scratchbox\box\scratchbox}%
+ \ht\scratchbox=.5\ht\scratchbox
+ \dp\scratchbox= \ht\scratchbox
+ \box\scratchbox
+ \egroup
+ \startstandardmakeup
+ \dontcomplain
+ \leftskip 0pt plus 50pt
+ \rightskip 0pt plus 50pt
+ \parfillskip 0pt
+ \baselineskip 100pt
+ \unhcopy\CollectedIdeas
+ \stopstandardmakeup}
+
+\unexpanded\def\StartIdea
+ {\ifnum\CurrentTopic=6
+ \global\CurrentTopic\plusone
+ \else
+ \global\advance\CurrentTopic\plusone
+ \fi
+ \definecolor[LineColor][linecolor \number\CurrentTopic]
+ \setbox\CollectedIdeas\null}
+
+\unexpanded\def\StopIdea
+ {}
+
+\unexpanded\def\StartTitlePage
+ {\startstandardmakeup
+ \setupalign[middle]
+ \unexpanded\def\\{\vfil\bfb\setupinterlinespace}
+ \bfd\setupinterlinespace
+ \vfil}
+
+\unexpanded\def\StopTitlePage
+ {\vfil\vfil
+ \stopstandardmakeup}
+
+\unexpanded\def\TitlePage#1%
+ {\StartTitlePage#1\StopTitlePage}
+
+\startsetups document:start
+ \StartTitlePage
+ \documentvariable{title}
+ \doifsomething {\documentvariable{subtitle}} {
+ \\
+ \documentvariable{subtitle}
+ }
+ \doifsomething {\documentvariable{location}} {
+ \\
+ \documentvariable{location}
+ }
+ \StopTitlePage
+\stopsetups
+
+\startsetups document:stop
+ %
+\stopsetups
+
+\stopmodule
+
+\continueifinputfile{s-present-balls.mkiv}
+
+\usemodule[present-common]
+
+\inputpresentationfile{examples/present-balls-001.tex}
diff --git a/tex/context/modules/mkiv/s-present-banner.mkiv b/tex/context/modules/mkiv/s-present-banner.mkiv
new file mode 100644
index 000000000..d93c033f2
--- /dev/null
+++ b/tex/context/modules/mkiv/s-present-banner.mkiv
@@ -0,0 +1,132 @@
+
+%D [ file=s-present-banner,
+%D version=2016.04.30, % around
+%D title=\CONTEXT\ Style File,
+%D subtitle=Presentation Environment Banner,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+%D This style was made for the Bacho\TeX\ 2016 conference. The banner below
+%D the text advances through the title.
+
+\startmodule[present-banner]
+
+\definecolor[maincolor] [b=.65]
+\definecolor[othercolor][s=.35]
+
+\startluacode
+ function mp.Banner(s,mode)
+ -- local r = tex.count.realpageno
+ local r = tex.count.realpageno - 1
+ local n = #s
+ local i = mode and 1 or 0
+ local t = string.gsub(s,".",function(s)
+ if s == " " or i > n then
+ return s
+ elseif i == r then
+ i = i + 1
+ if mode then
+ return "\\color[othercolor]{" .. s .. "}"
+ else
+ return "\\maincolor " .. s
+ end
+ else
+ i = i + 1
+ return s
+ end
+ end)
+ mp.quoted(t)
+ end
+\stopluacode
+
+\startuseMPgraphic{page}
+ StartPage ;
+ fill Page withcolor \MPcolor{maincolor} ;
+ draw anchored(image (
+ % draw textext.top (lua.mp.Banner("\documentvariable{title}",true))
+ draw textext.top (lua.mp.Banner("\documentvariable{title}",false))
+ xsized (.9PaperWidth)
+ withcolor white;
+ ), center bottomboundary Page);
+ % fill Field[Text][Text] enlarged 10pt withcolor (\MPcolor{maincolor})/1.5 ;
+ fill Field[Text][Text] enlarged 10pt withcolor .1white ;
+ StopPage ;
+\stopuseMPgraphic
+
+\setupbackgrounds
+ [page]
+ [background=page]
+
+\defineoverlay
+ [page]
+ [\useMPgraphic{page}]
+
+\setupbodyfont
+ [lucidaot,10pt]
+
+\setuppapersize
+ [S6]
+
+\setuplayout
+ [backspace=30pt,
+ width=middle,
+ height=middle,
+ topspace=30pt,
+ bottomspace=100pt,
+ header=0pt,
+ footer=0pt,
+ margin=0pt]
+
+\setupcolors
+ [textcolor=white]
+
+\setupwhitespace
+ [big]
+
+\setuphead
+ [chapter]
+ [style=\bfd,
+ after={\blank[big]}]
+
+\setuphead
+ [section]
+ [style=\bfa,
+ before=\blank,
+ after={\blank[medium]}]
+
+\definehighlight[nb][style=bold]
+
+\setupitemgroup[itemize][before=,after=]
+\setupitemgroup[itemize][packed]
+
+\setupdocument
+ [title=Title,
+ subtitle=Subtitle,
+ location=\currentdate]
+
+\startsetups document:start
+
+ \startstandardmakeup
+
+ \raggedcenter
+
+ \dontleavehmode\scale[width=1.00\textwidth]{\documentvariable{title}} \vfil
+ \dontleavehmode\scale[width=0.75\textwidth]{\documentvariable{subtitle}} \vfil
+ \dontleavehmode\scale[width=0.45\textwidth]{\documentvariable{location}} \vfil
+
+ \stopstandardmakeup
+
+\stopsetups
+
+\stopmodule
+
+\continueifinputfile{s-present-banner.mkiv}
+
+\usemodule[present-common]
+
+\inputpresentationfile{bachotex/2016/bachotex-2016-opentype.tex}
diff --git a/tex/context/modules/mkiv/s-present-bars.mkiv b/tex/context/modules/mkiv/s-present-bars.mkiv
new file mode 100644
index 000000000..13c09ff3b
--- /dev/null
+++ b/tex/context/modules/mkiv/s-present-bars.mkiv
@@ -0,0 +1,128 @@
+%D \module
+%D [ file=s-present-bars,
+%D version=2012.07.10,
+%D title=\CONTEXT\ Style File,
+%D subtitle=Presentation Environment bars,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+%D Okay, this one makes me a bit ashamed as it's probably too simple and unattractive but
+%D as it was used for a whole bunch of presentations it made it into a module anyway.
+
+\startmodule[present-bars]
+
+\setupbodyfont
+ [dejavu]
+
+\setuppapersize
+ [S6]
+
+\setuplayout
+ [backspace=12pt,
+ width=middle,
+ height=middle,
+ topspace=12pt,
+ header=36pt,
+ footer=36pt,
+ headerdistance=12pt,
+ footerdistance=12pt]
+
+\definecolor
+ [maincolor]
+ [darkblue]
+
+\startreusableMPgraphic{page}
+ StartPage ;
+ fill
+ Page
+ withcolor \MPcolor{maincolor} ;
+ fill
+ Field[Text][Header]
+ leftenlarged BackSpace
+ rightenlarged CutSpace
+ withcolor darkgray ;
+ fill
+ Field[Text][Footer]
+ leftenlarged BackSpace
+ rightenlarged CutSpace
+ withcolor darkgray ;
+ StopPage ;
+\stopreusableMPgraphic
+
+\setupheader
+ [color=maincolor,
+ style=bold,
+ before=\vss,
+ after=\vss]
+
+\setupheader
+ [color=maincolor,
+ style=bold,
+ before=\vss,
+ after=\vss]
+
+\setupheadertexts
+ [Breskens 2012]
+ [\getvariable{document}{title}]
+
+\setupbackgrounds
+ [page]
+ [background=page]
+
+\defineoverlay
+ [page]
+ [\reuseMPgraphic{page}]
+
+\setupbackgrounds
+ [footer][text]
+ [background=goback]
+
+\defineoverlay
+ [goback]
+ [\overlaybutton{PreviousPage}]
+
+\setuppagenumbering
+ [location=]
+
+\setupcolors
+ [textcolor=white]
+
+\setvariables
+ [document]
+ [maincolor=darkblue,
+ set=\setups{document:setup}]
+
+\startsetups document:setup
+
+ \doifsomething {\getvariable{document}{color}} {
+
+ \definecolor[maincolor][\getvariable{document}{color}]
+
+ }
+
+\stopsetups
+
+\setupinteraction
+ [state=start,
+ click=no]
+
+\usemodule[abr-01]
+\usemodule[pre-60]
+
+\stopmodule
+
+\continueifinputfile{s-present-bars.mkiv}
+
+\usemodule[present-common]
+
+%\inputpresentationfile{context/2012/context-2012-after-the-cleanup.tex}
+%\inputpresentationfile{context/2012/context-2012-the-script.tex}
+%\inputpresentationfile{context/2012/context-2012-lexing-sources.tex}
+%\inputpresentationfile{context/2012/context-2012-mixed-columns.tex}
+%\inputpresentationfile{context/2012/context-2012-visual-debugging.tex}
+\inputpresentationfile{context/2012/context-2012-xml-news.tex}
diff --git a/tex/context/modules/mkiv/s-present-colorful.mkiv b/tex/context/modules/mkiv/s-present-colorful.mkiv
new file mode 100644
index 000000000..ed4b5f7c4
--- /dev/null
+++ b/tex/context/modules/mkiv/s-present-colorful.mkiv
@@ -0,0 +1,384 @@
+%D \module
+%D [ file=s-present-colorful, % was s-pre-04
+%D version=1998.09.06,
+%D title=\CONTEXT\ Style File,
+%D subtitle=Presentation Environment Colorful,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+\usemodule[present-general]
+
+\startmodule[present-colorful]
+
+%D \macros
+%D {setupbodyfont}
+%D
+%D This is just another environment for typesetting interactive presentations. I
+%D wrote this module on behalf of a course I gave for the United Kingdom \TeX\ users
+%D group.
+
+\setupbodyfont[postscript,14.4pt]
+
+%D \macros
+%D {setupcolors,definecolor}
+%D
+%D I started using dark blue for the navigational elements. In that context, dark
+%D red is a logical choice for the contrast color. While playing around with the
+%D navigational elements I decided to use the not so dominant color yellow for the
+%D status bar.
+%D
+%D A few days before I wrote this style, the recent acquisition of Mondriaans last
+%D painting by the Dutch governement was a hot topic in the Dutch news scenary.
+%D Therefore I decided to replace the rather dull title page by something more
+%D colorful, in mondriaan colors, but far more random than any of his paintings. For
+%D consistence we remap the already defined primary colors.
+%D
+%D The \MKIV\ version is adapted abit so that the title is better visible.
+
+\setupcolors [state=start]
+
+\definecolor [NoneColor] [s=.6]
+\definecolor [GotoColor] [b=.6] \definecolor[blue] [GotoColor]
+\definecolor [ExitColor] [r=.6] \definecolor[red] [ExitColor]
+\definecolor [JumpColor] [s=.6]
+\definecolor [UserColor] [g=.6] \definecolor[green] [UserColor]
+%definecolor [StepColor] [r=.6,g=.6] \definecolor[yellow][StepColor]
+\definecolor [StepColor] [y=.8] \definecolor[yellow][StepColor]
+
+\definecolor [PageColor] [s=.80] \definecolor[gray] [PageColor]
+\definecolor [TextColor] [s=.90]
+\definecolor [TitleColor][s=.90]
+
+%D \macros
+%D {setuppapersize}
+%D
+%D As usual, we take a screen oriented paper size:
+
+\setuppapersize
+ [S6][S6]
+
+%D \macros
+%D {setuplayout,setupinteractionscreen}
+%D
+%D The layout definition fits into this $600\times450$ point area, but the
+%D dimensions are somewhat diffused by the text background offset.
+
+\setuplayout
+ [width=530pt,
+ height=400pt,
+ header=0pt,
+ footer=0pt,
+ backspace=15pt,
+ topspace=15pt,
+ bottomdistance=15pt,
+ bottom=10pt,
+ margin=0pt,
+ rightedgedistance=15pt,
+ rightedge=30pt]
+
+\setupinteractionscreen
+ [option=max]
+
+%D \macros
+%D {setupbackgrounds}
+%D
+%D Both the page and the text area have a gray background. The \type {[text,text]}
+%D area also has an offset. Later we will see that we have to compensate for that in
+%D the navigational areas.
+
+\setupbackgrounds
+ [page]
+ [background=color,
+ backgroundcolor=PageColor]
+
+\setupbackgrounds
+ [text][text]
+ [background=color,
+ backgroundcolor=TextColor,
+ backgroundoffset=5pt]
+
+%D \macros
+%D {setupinteraction}
+%D
+%D For convenient navigation, we turn on interaction.
+
+\setupinteraction
+ [state=start,
+ menu=on,
+ color=UserColor,
+ contrastcolor=NoneColor]
+
+%D \macros
+%D {setupsubpagenumber}
+%D
+%D When navigating the document, we keep the title page out of sight, therefore we
+%D use sub page numbers.
+
+\setupsubpagenumber
+ [state=start,
+ way=bytext]
+
+%D \macros
+%D {setupinteractionmenu}
+%D
+%D There is only one interaction menu, located in the right edge of the screen. Both
+%D offsets enlarge the edge by the same amount as the text background offset.
+
+\setupinteractionmenu
+ [right]
+ [state=start,
+ frame=off,
+ strut=no,
+ offset=0pt,
+ inbetween=,
+ bottomoffset=-5pt,
+ topoffset=-5pt]
+
+%D \macros
+%D {startinteractionmenu}
+%D
+%D The menu itself is not that spectacular. We use the start||stop alternative for
+%D setting the content. The macro \type {\interactioncolor} expands into either the
+%D interaction color or the contrast color, the latter only when no jump is
+%D possible.
+
+\startinteractionmenu[right]
+ \setupinteraction[color=GotoColor]
+ \but [previoussubpage] \Triangle {90}\hsize\interactioncolor \\
+ \vskip10pt
+ \but [nextsubpage] \Triangle{270}\hsize\interactioncolor \\
+ \vfill
+ \but [PreviousJump] \Triangle{180}\hsize{NoneColor} \\
+ \vskip-5pt
+ \but [NextJump] \Triangle {0}\hsize{NoneColor} \\
+\stopinteractionmenu
+
+%D \macros
+%D {setupinteractionbar}
+%D
+%D The interaction bar at the bottom is also larger than the normal width of the
+%D bottom area.
+
+\setupinteractionbar
+ [width=\textwidth,
+ height=\bottomheight,
+ distance=10pt,
+ color=NoneColor,
+ contrastcolor=StepColor]
+
+%D \macros
+%D {setupbottomtexts}
+%D
+%D The bar is centered in the middle.
+
+\setupbottomtexts
+ [{\interactionbar[alternative=f]}]
+
+%D We can exit viewing with a close button, located on the rightmost bottom area.
+
+\unexpanded\def\CloseButton
+ {\ifnum\realpageno>\plusone
+ \button
+ [width=\rightedgewidth,
+ height=\bottomheight,
+ offset=overlay,
+ background=color,
+ backgroundcolor=ExitColor,
+ frame=off]
+ {}%
+ [CloseDocument]%
+ \fi}
+
+\setupbottomtexts
+ [edge][][\CloseButton]
+
+%D \macros
+%D {definesymbol,setupitemize}
+%D
+%D Because some prominent things are rectangular or triangular, we prefer some
+%D different symbols in itemizations:
+
+\definesymbol[1][\blacktriangleright]
+\definesymbol[2][\blacktriangledown]
+\definesymbol[3][\blacktriangleright]
+\definesymbol[4][\blacktriangledown]
+
+\setupitemize[each][color=NoneColor]
+
+%D \macros
+%D {TitlePage,defineoverlay,button,setupalign,
+%D setupbackgrounds,setupinteraction,setupinteractionbar,
+%D startstandardmakeup,switchtobodyfont,setupinterlinespace}
+%D
+%D Now the main layout and navigational definitions are done, it makes sense to
+%D define and tune some structuring commands. First we build the titlepage.
+
+\defineoverlay [TitleGraphic] [\useMPgraphic{title}]
+\defineoverlay [NextPage] [\overlaybutton{nextpage}]
+
+\unexpanded\def\StartTitlePage
+ {\setupbackgrounds[page][background={color,TitleGraphic,NextPage}]
+ \setupbackgrounds[text][text][background=]
+ \setupinteraction[menu=off]
+ \setupinteractionbar[state=stop]
+ \startpagemakeup
+ \switchtobodyfont[24pt]
+ \bfd\setupinterlinespace
+ \setupalign[middle]
+ \vfil
+ \let\\=\vfil
+ \scale
+ [factor=max]\bgroup
+ \framed
+ [frame=off,
+ align=middle,
+ foregroundcolor=TitleColor,
+ offset=.05\textwidth]
+ \bgroup}
+
+\unexpanded\def\StopTitlePage
+ {\egroup
+ \egroup
+ \vfil\vfil\vfil
+ \stoppagemakeup
+ \setupinteraction[menu=on]
+ \setupinteractionbar[state=start]
+ \setupbackgrounds[page][background=color]
+ \setupbackgrounds[text][text][background=color]}
+
+\unexpanded\def\TitlePage#1%
+ {\StartTitlePage#1\StopTitlePage}
+
+%D \macros
+%D {Topic, Nopic, Subject,
+%D definehead, setuphead}
+%D
+%D We use \type {\Topic} and \type {\Subject} instead of chapters and sections. The
+%D \type {\Nopic} alternative is meant for internal use.
+
+\definehead [Topic] [chapter]
+\definehead [Nopic] [title]
+\definehead [Subject] [section]
+
+\setuphead
+ [Topic,Nopic]
+ [after={\blank[3*medium]},
+ number=no,
+ style=\bfb,
+ page=yes,
+ alternative=middle]
+
+\setuphead
+ [Subject]
+ [after=\blank,
+ number=no,
+ page=yes,
+ continue=no,
+ style=\bfa]
+
+%D \macros
+%D {Topics, Subjects,
+%D setuplist, placelist, startcolumns}
+%D
+%D This style is meant for the more large presentations, and therefore provided for
+%D a list of topics as well as local lists of subjects. When many topics are
+%D introduces, the list is typeset in columns.
+
+\setuplist
+ [Topic,Subject]
+ [alternative=g,
+ interaction=all,
+ before=,
+ after=]
+
+\setuplist
+ [Topic]
+ [criterium=all]
+
+\unexpanded\def\Topics#1%
+ {\determinelistcharacteristics[Topic]
+ \ifnum\utilitylistlength>0
+ \Nopic[Topics]{#1}
+ \ifnum\utilitylistlength>12
+ \startcolumns
+ \placelist[Topic]
+ \stopcolumns
+ \else
+ \placelist[Topic]
+ \fi
+ \fi}
+
+\unexpanded\def\Subjects%
+ {\placelist[Subject]}
+
+%D Last we define the overlays. Look at the way colors are linked into the macros.
+
+\setupMPvariables
+ [triangle]
+ [width=1cm,
+ rotation=0,
+ color=black]
+
+\startuniqueMPgraphic{triangle}{width,rotation,color}
+ fill triangle xsized \MPvar{width} rotated \MPvar{rotation} withcolor \MPvar{color} ;
+\stopuniqueMPgraphic
+
+\unexpanded\def\Triangle#1#2#3%
+ {\uniqueMPgraphic{triangle}{rotation=#1,width=#2,c:color=#3}}
+
+% \startuseMPgraphic{title}
+% path p ; numeric sx, sy, cc ;
+% for i=1 upto 250 :
+% sx := uniformdeviate 30 ;
+% sy := uniformdeviate 30 ;
+% cc := round(uniformdeviate 2) ;
+% if round(uniformdeviate 1) = 0 :
+% p := unitsquare xscaled sx yscaled sy ;
+% else :
+% p := unittriangle scaled sx rotated (round(uniformdeviate 3) * 90) ;
+% fi ;
+% p := p shifted (uniformdeviate OverlayWidth,uniformdeviate OverlayHeight) ;
+% fill p
+% withcolor
+% if cc = 0 : "GotoColor"
+% elseif cc = 1 : "ExitColor"
+% elseif cc = 2 : "StepColor" fi ;
+% endfor ;
+% \stopuseMPgraphic
+
+\startuseMPgraphic{title}
+ path p ; numeric sx, sy, cc ;
+ fill Page withcolor "StepColor" ;
+ for i=1 upto 1000 :
+ sx := 50 + uniformdeviate 50 ;
+ sy := 50 + uniformdeviate 50 ;
+ cc := round(uniformdeviate 2) ;
+ if round(uniformdeviate 1) = 0 :
+ p := unitsquare xscaled sx yscaled sy ;
+ else :
+ p := unittriangle scaled sx rotated (round(uniformdeviate 3) * 90) ;
+ fi ;
+ p := p shifted (uniformdeviate OverlayWidth,uniformdeviate OverlayHeight) ;
+ fill p
+ withcolor
+ if cc = 0 : "GotoColor"
+ elseif cc = 1 : "ExitColor"
+ elseif cc = 2 : "StepColor" fi ;
+ draw p
+ withpen pencircle scaled 1/2
+ withcolor white ;
+ endfor ;
+\stopuseMPgraphic
+
+\stopmodule
+
+\continueifinputfile{s-present-colorful.mkiv}
+
+\usemodule[present-common]
+
+\inputpresentationfile{examples/present-colorful-001.tex}
diff --git a/tex/context/modules/mkiv/s-present-common.mkiv b/tex/context/modules/mkiv/s-present-common.mkiv
new file mode 100644
index 000000000..b4b422ca5
--- /dev/null
+++ b/tex/context/modules/mkiv/s-present-common.mkiv
@@ -0,0 +1,43 @@
+%D \module
+%D [ file=s-present-common,
+%D version=2016.10.20,
+%D title=\CONTEXT\ Style File,
+%D subtitle=Presentation Common Helpers,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+\startmodule[present-common]
+
+\startluacode
+
+ -- sources -> presentations
+ -- tex/context/base/mkiv -> doc/context/presentations
+
+ function commands.inputpresentationfile(name)
+ local mkivpath = file.pathpart(resolvers.findfile("context.mkiv"))
+ local filename = file.join(mkivpath,"../presentations",name)
+ if lfs.isfile(filename) then
+ context.input(filename)
+ return
+ end
+ filename = file.join(mkivpath,"../../../../doc/context/presentations",name)
+ if lfs.isfile(filename) then
+ context.input(filename)
+ return
+ end
+ context.starttext()
+ context.formatted.type("missing file: %s",name)
+ context.stoptext()
+ end
+
+\stopluacode
+
+\unexpanded\def\inputpresentationfile#1%
+ {\ctxcommand{inputpresentationfile("#1")}}
+
+\stopmodule
diff --git a/tex/context/modules/mkiv/s-present-four.mkiv b/tex/context/modules/mkiv/s-present-four.mkiv
new file mode 100644
index 000000000..347790e26
--- /dev/null
+++ b/tex/context/modules/mkiv/s-present-four.mkiv
@@ -0,0 +1,188 @@
+%D \module
+%D [ file=s-present-four,
+%D version=2011.04.15, % about
+%D title=\CONTEXT\ Style File,
+%D subtitle=Presentation Environment Four,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+%D Just another one-time used Bacho\TEX\ presentation style that I found back
+%D when cleaning up old files. It's just simple pages in a shape and this time
+%D we hook it into a section command.
+
+\startmodule[present-four]
+
+\setupbodyfont
+ [dejavu,11pt]
+
+\setupcolors
+ [textcolor=white]
+
+\setupalign
+ [flushleft]
+
+\startuseMPgraphic{page}
+ vardef One =
+ ulcorner Page --
+ .75[ulcorner Page, urcorner Page] --
+ .60[ulcorner Page, lrcorner Page] --
+ .75[ulcorner Page, llcorner Page] --
+ cycle
+ enddef;
+ vardef One =
+ ulcorner Page --
+ .80[ulcorner Page, urcorner Page] --
+ .65[ulcorner Page, lrcorner Page] --
+ .80[ulcorner Page, llcorner Page] --
+ cycle
+ enddef;
+ vardef Two = One rotatedaround(center Page, 90) enddef ;
+ vardef Three = One rotatedaround(center Page,180) enddef ;
+ vardef Four = One rotatedaround(center Page,270) enddef ;
+ StartPage ;
+ if CurrentLayout = "layout:0" :
+ fill Two withcolor .25[red,blue] ;
+ fill Three withcolor .25[blue,yellow] ;
+ fill Four withcolor .25[yellow,blue] ;
+ fill One withcolor .5white ;
+ elseif CurrentLayout = "layout:1" :
+ fill Two withcolor .25[red,blue] ;
+ fill Three withcolor .25[blue,yellow] ;
+ fill Four withcolor .25[yellow,blue] ;
+ fill One withcolor .25[green,red] ;
+ elseif CurrentLayout = "layout:2" :
+ fill One withcolor .25[green,red] ;
+ fill Two withcolor .25[red,blue] ;
+ fill Three withcolor .25[blue,yellow] ;
+ fill Four withcolor .25[yellow,blue] ;
+ elseif CurrentLayout = "layout:3" :
+ fill One withcolor .25[green,red] ;
+ fill Two withcolor .25[red,blue] ;
+ fill Four withcolor .25[yellow,blue] ;
+ fill Three withcolor .25[blue,yellow] ;
+ elseif CurrentLayout = "layout:4" :
+ fill One withcolor .25[green,red] ;
+ fill Three withcolor .25[blue,yellow] ;
+ fill Four withcolor .25[yellow,blue] ;
+ fill Two withcolor .25[red,blue] ;
+ fi ;
+ StopPage ;
+\stopuseMPgraphic
+
+\setupbackgrounds
+ [page]
+ [background={page}]
+
+\setupinteraction
+ [state=start,
+ click=no]
+
+\setupinteractionscreen
+ [option=max]
+
+\defineoverlay
+ [page]
+ [\useMPgraphic{page}]
+
+\definepapersize
+ [mine]
+ [width=400pt,
+ height=400pt]
+
+\setuppapersize
+ [mine]
+
+\setuplayout
+ [header=0pt,
+ footer=0pt,
+ margin=0pt,
+ width=middle,
+ height=middle]
+
+% \showframe
+
+\definelayout
+ [layout:0]
+ [backspace=10pt,cutspace=.375\paperwidth,
+ bottomspace=.35\paperheight,topspace=10pt]
+
+\definelayout
+ [layout:1]
+ [backspace=10pt,cutspace=.375\paperwidth,
+ bottomspace=.35\paperheight,topspace=10pt]
+
+\definelayout
+ [layout:2]
+ [backspace=.35\paperwidth,cutspace=10pt,
+ bottomspace=.375\paperheight,topspace=10pt]
+
+\definelayout
+ [layout:3]
+ [backspace=.375\paperwidth,cutspace=10pt,
+ bottomspace=10pt,topspace=.375\paperheight]
+
+\definelayout
+ [layout:4]
+ [backspace=10pt,cutspace=.375\paperwidth,
+ bottomspace=10pt,topspace=.35\paperheight]
+
+\setuptyping
+ [space=fixed]
+
+\startluacode
+ local n = -1
+ function documentdata.StartPage()
+ if n == 4 then
+ n = 1
+ else
+ n = n + 1
+ end
+ context.setuplayout { string.format("layout:%s",n) }
+ end
+ function documentdata.StopPage()
+ context.page()
+ end
+\stopluacode
+
+\unexpanded\def\StartPage
+ {\bgroup
+ \ctxlua{documentdata.StartPage()}}
+
+\unexpanded\def\StopPage
+ {\ctxlua{documentdata.StopPage()}
+ \egroup}
+
+\startsetups subject:start
+ \bgroup
+ \ctxlua{documentdata.StartPage()}
+\stopsetups
+
+\startsetups subject:stop
+ \ctxlua{documentdata.StopPage()}
+ \egroup
+\stopsetups
+
+\setuphead[subject]
+ [beforesection=\directsetup{subject:start},
+ aftersection=\directsetup{subject:stop}]
+
+\startsetups document:start
+ \StartPage
+ \definedfont[SerifBold*default at 48pt]
+ \setupinterlinespace
+ \documentvariable{title}
+ \StopPage
+\stopsetups
+
+\stopmodule
+
+\continueifinputfile{s-present-four.mkiv}
+
+\usemodule[present-common]
+
+\inputpresentationfile{bachotex/2011/bachotex-2011-cld-and-mkvi.tex}
diff --git a/tex/context/modules/mkiv/s-present-funny.mkiv b/tex/context/modules/mkiv/s-present-funny.mkiv
new file mode 100644
index 000000000..4948766ad
--- /dev/null
+++ b/tex/context/modules/mkiv/s-present-funny.mkiv
@@ -0,0 +1,208 @@
+%D \module
+%D [ file=s-present-funny, % was s-pre-03
+%D version=1998.09.06,
+%D title=\CONTEXT\ Style File,
+%D subtitle=Presentation Environment Funny,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+\startmodule[present-funny]
+
+%D This is the third environment for typesetting interactive presentations. I used
+%D this style for a talk on \TEX\ and \JAVASCRIPT\ at \TUG98, mainly because I
+%D didn't want to use the same style three times. Therefore this is a rather simple,
+%D silly style.
+
+\usemodule[pre-general]
+
+%D \macros
+%D {setupbodyfont}
+%D
+%D We use a large bodyfont. Combined with the fancy
+%D background, this does not leave that much room for text, but
+%D presentations should use much text anyway.
+
+\doifelsemode {asintended} {
+ \setupbodyfont[ludicaot,14.4pt]
+} {
+ \setupbodyfont[pagella,14.4pt]
+}
+
+%D \macros
+%D {setuppapersize,setuplayout,setupinteractionscreen}
+%D
+%D The page dimensions are set to size \type {S6}, being 600pt by 450pt. We use wide
+%D margins and discard headers and footers. We also launch the document full screen.
+
+\setuppapersize
+ [S6][S6]
+
+\setuplayout
+ [width=middle,
+ height=middle,
+ topspace=75pt,
+ backspace=100pt,
+ header=0pt,
+ footer=0pt]
+
+\setupinteractionscreen
+ [option=max]
+
+%D \macros
+%D {definecolor}
+%D
+%D Next, color support is turned on and a dark red color is defined. Other red
+%D shades will be derived from this one color.
+
+\definecolor [PageColor] [black]
+\definecolor [BackgroundColor] [s=.85]
+\definecolor [OrnamentColor] [r=.75]
+\definecolor [PositionColor] [s=.55]
+
+%D \macros
+%D {setupinteraction}
+%D
+%D We turn on interaction mode and use the same color for hyperlinks and redundant
+%D hyperlinks (the ones that point to the current page).
+
+\setupinteraction
+ [state=start,
+ contrastcolor=OrnamentColor,
+ color=OrnamentColor]
+
+%D \macros
+%D {defineoverlay, setupbackgrounds}
+%D
+%D The joke in this presentation is the elliptical shape of which the bottom part
+%D includes a page indication.
+
+\defineoverlay
+ [PageShape][\useMPgraphic{PageShape}]
+
+\startuseMPgraphic{PageShape}
+ StartPage ;
+ path p ; pair pa, pb ; numeric len ; color contrastcolor ;
+ fill Page withcolor \MPcolor {PageColor} ;
+ pickup pencircle rotated 45 xscaled 10pt yscaled 20pt ;
+ p := Page enlarged (-10pt,-15pt) superellipsed .8 ;
+ p := p shifted (-1.5pt,0) ; % looks better
+ fill p withcolor \MPcolor{BackgroundColor} ;
+ draw p withcolor \MPcolor{OrnamentColor} ;
+ contrastcolor = \MPcolor{PositionColor} ;
+ if (RealPageNumber > 0) and (NOfPages > 0):
+ draw point 5 of p withcolor contrastcolor ;
+ draw point 7 of p withcolor contrastcolor ;
+ len := 2/NOfPages ;
+ pa := point (5+len* RealPageNumber ) of p ;
+ pb := point (5+len*(RealPageNumber-1)) of p ;
+ draw (p cutafter pa) cutbefore pb
+ withcolor contrastcolor ;
+ fi ;
+ StopPage ;
+\stopuseMPgraphic
+
+%D We use the viewer provided feature to go to the previous or next page.
+
+\defineoverlay[PrevButton][\overlaybutton{PreviousPage}]
+\defineoverlay[NextButton][\overlaybutton{NextPage}]
+
+\setupbackgrounds
+ [page]
+ [background={PageShape,PrevButton}]
+
+\setupbackgrounds
+ [text][text]
+ [background=NextButton]
+
+% or using hard coded next/prev pages:
+%
+% \defineoverlay[PrevButton][\overlaybutton{previouspage}]
+% \defineoverlay[NextButton][\overlaybutton{nextpage}]
+%
+% \setupbackgrounds[state=repeat]
+% \setupbackground[text][text][background=NextButton]
+%
+% or simply (using an repeated layer):
+%
+% \setupbackground[text][background=NextButton]
+
+%D \macros
+%D {definehead, setuphead}
+%D
+%D Like the other presentation styles, we use \type {\Topic} instead of \type
+%D {\chapters}. This time we don't provide an additional sectioning. So we have:
+%D
+%D \starttyping
+%D \TitlePage{How nice}
+%D
+%D \Topics{This is about ...}
+%D
+%D \Topic{The first one}
+%D
+%D \Topic{Another one}
+%D \stoptyping
+
+\definehead [Topic] [chapter]
+\definehead [Nopic] [title]
+
+\setuphead
+ [Topic,Nopic]
+ [after={\blank[3*medium]},
+ number=no,
+ style=\bfb,
+ page=yes,
+ alternative=middle]
+
+\setuplist
+ [Topic]
+ [alternative=g,
+ interaction=all,
+ before=,
+ after=]
+
+\let\Subject\Topic
+
+%D The tables of contents is associated with \type {\Topics}.
+
+\unexpanded\def\Topics#1%
+ {\Nopic[Topics]{#1}
+ \placelist[Topic][criterium=all]}
+
+\unexpanded\def\Subjects
+ {}
+
+%D Instead of \type {\TitlePage}, one can use the pair \type {\StartTitlePage} --
+%D \type {\StopTitlePage}:
+%D
+%D \starttyping
+%D \StartTitlePage
+%D A Self Made Title
+%D \StopTitlePage
+%D \stoptyping
+
+\unexpanded\def\StartTitlePage
+ {\startstandardmakeup
+ \bfd\setupinterlinespace
+ \setupalign[middle]
+ \vfil
+ \def\\{\vfil\bfb\setupinterlinespace}}
+
+\unexpanded\def\StopTitlePage
+ {\vfil\vfil\vfil
+ \stopstandardmakeup}
+
+\unexpanded\def\TitlePage#1%
+ {\StartTitlePage#1\StopTitlePage}
+
+\stopmodule
+
+\continueifinputfile{s-present-funny.mkiv}
+
+\usemodule[present-common]
+
+\inputpresentationfile{examples/present-funny-001.tex}
diff --git a/tex/context/modules/mkiv/s-present-fuzzy.mkiv b/tex/context/modules/mkiv/s-present-fuzzy.mkiv
new file mode 100644
index 000000000..ee029b0e6
--- /dev/null
+++ b/tex/context/modules/mkiv/s-present-fuzzy.mkiv
@@ -0,0 +1,225 @@
+%D \module
+%D [ file=s-present-fuzzy, % was s-pre-05
+%D version=1998.12.12,
+%D title=\CONTEXT\ Style File,
+%D subtitle=Presentation Environment Fuzzy,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+\usemodule[present-general]
+
+\startmodule[present-fuzzy]
+
+%D As all styles sofar, this one has the same structuring commands.
+
+\doifelsemode {asintended} {
+ \setupbodyfont[ludicaot,14.4pt]
+} {
+ \setupbodyfont[pagella,14.4pt]
+}
+
+\definecolor [BackgroundColor] [s=.95]
+\definecolor [OrnamentColor] [r=.6,g=.7,b=.8]
+
+\setuppapersize
+ [S6][S6]
+
+\setuplayout
+ [width=430pt,
+ height=400pt,
+ header=0pt,
+ footer=0pt,
+ margin=0pt,
+ backspace=25pt,
+ topspace=25pt,
+ rightedgedistance=20pt,
+ rightedge=110pt]
+
+\setupinteractionscreen
+ [option=max]
+
+\setupbackgrounds
+ [state=repeat]
+
+\setupbackgrounds
+ [page]
+ [backgroundcolor=white]
+
+\setupbackgrounds
+ [text][text]
+ [background={HashFrameA,NextPage},
+ backgroundoffset=20pt]
+
+\defineoverlay
+ [HashFrameA]
+ [\useMPgraphic{HashFrameA}]
+
+\defineoverlay
+ [HashFrameB]
+ [\useMPgraphic{HashFrameB}]
+
+\setupinteraction
+ [state=start,
+ menu=on,
+ color=OrnamentColor,
+ contrastcolor=OrnamentColor]
+
+%D Watch how we use a list alternative that matches the menu.
+
+\setupinteractionmenu
+ [right]
+ [background=HashFrameB,
+ style=smallbold,
+ frame=off,
+ offset=10pt,
+ height=35pt,
+ before=,
+ after=,
+ inbetween=\endgraf,
+ width=\rightedgewidth]
+
+\startinteractionmenu[right]
+ \placelist
+ [Topic]
+ [criterium=all,
+ alternative=right,
+ maxwidth=.8\rightedgewidth,
+ interaction=all,
+ before=,
+ after=]
+ \vfill
+ \setupinteractionmenu
+ [right]
+ [height=30pt]
+ \but [CloseDocument] Close \\
+\stopinteractionmenu
+
+\setupwhitespace
+ [big]
+
+\setupblank
+ [big]
+
+%D \macros
+%D {TitlePage}
+%D
+%D Now the main layout and navigational definitions are done, it makes sense to
+%D define and tune some structuring commands. First we build the titlepage.
+
+\defineoverlay [TitleGraphic] [\useMPgraphic{TitleGraphic}]
+\defineoverlay [NextPage] [\overlaybutton{forward}]
+
+\unexpanded\def\StartTitlePage
+ {\setupbackgrounds[page][background={color,TitleGraphic,NextPage}]
+ \setupbackgrounds[text][text][background=]
+ \setupinteraction[menu=off]
+ \setupinteractionbar[state=stop]
+ \setuplayout[width=550pt,rightedge=0pt]
+ \startstandardmakeup
+ \switchtobodyfont[24pt]
+ \bfd\setupinterlinespace
+ \setupalign[middle]
+ \vfil
+ \let\\=\vfil}
+
+\unexpanded\def\StopTitlePage
+ {\vfil\vfil\vfil
+ \stopstandardmakeup
+ \setuplayout[width=430pt,rightedge=110pt]
+ \setupinteraction[menu=on]
+ \setupinteractionbar[state=start]
+ \setupbackgrounds[page][background=color]
+ \setupbackgrounds[text][text][background={HashFrameA,NextPage}]}
+
+\unexpanded\def\TitlePage#1%
+ {\StartTitlePage#1\StopTitlePage}
+
+%D \macros
+%D {Topics,Subjects}
+%D
+%D Because the lists are in the menu, we don't honor list placement macros.
+
+\unexpanded\def\Topics#1{}
+\unexpanded\def\Subjects{}
+
+%D \macros
+%D {Topic, Nopic, Subject}
+%D
+%D Since this style is meant for rather flat structured documents, only \type
+%D {\Topic} makes sense.
+
+\definehead [Topic] [chapter]
+\definehead [Nopic] [title]
+\definehead [Subject] [section]
+
+\setuphead
+ [Topic, Nopic]
+ [after={\blank[3*medium]},
+ number=no,
+ style=\tfb,
+ page=yes,
+ alternative=middle]
+
+\setuphead
+ [Subject]
+ [after=\blank,
+ number=no,
+ page=yes,
+ continue=no,
+ style=\tfa]
+
+%D We use only one kind of base graphic, which is sligthly
+%D tuned for the different usage.
+
+\startMPdefinitions
+ def random_hash_frame (expr width, height, offset, linewidth ) =
+
+ def delta = ((uniformdeviate .5offset) + .25offset) enddef ;
+ x1 := offset ; y1 := offset ; x2 := width-offset ; y2 := height-offset ;
+
+ drawoptions(withpen pencircle scaled linewidth withcolor \MPcolor{BackgroundColor}) ;
+ fill z1--(x2,y1)--z2--(x1,y2)--cycle ;
+
+ drawoptions(withpen pencircle scaled linewidth withcolor \MPcolor{OrnamentColor}) ;
+ draw (x1-delta,y1)--(x2+delta,y1) ;
+ draw (x2,y1-delta)--(x2,y2+delta) ;
+ draw (x2+delta,y2)--(x1-delta,y2) ;
+ draw (x1,y2+delta)--(x1,y1-delta) ;
+
+ drawoptions();
+ setbounds currentpicture to unitsquare xscaled width yscaled height ;
+ enddef ;
+\stopMPdefinitions
+
+\startuseMPgraphic{HashFrameA}
+ random_hash_frame(OverlayWidth,OverlayHeight,15pt,2pt) ;
+\stopuseMPgraphic
+
+\startuseMPgraphic{HashFrameB}
+ random_hash_frame(OverlayWidth,OverlayHeight, 5pt,2pt) ;
+\stopuseMPgraphic
+
+\startuseMPgraphic{TitleGraphic}
+ numeric offset, width, height ;
+ for i=1 upto 300 :
+ offset := uniformdeviate 10pt ;
+ width := 2*offset + 30pt + uniformdeviate 30pt ;
+ height := 2*offset + 10pt + uniformdeviate 10pt ;
+ addto currentpicture also
+ image(random_hash_frame(width,height,offset,1pt)) shifted
+ (uniformdeviate OverlayWidth, uniformdeviate OverlayHeight) ;
+ endfor ;
+\stopuseMPgraphic
+
+\stopmodule
+
+\continueifinputfile{s-present-fuzzy.mkiv}
+
+\usemodule[present-common]
+
+\inputpresentationfile{examples/present-fuzzy-001.tex}
diff --git a/tex/context/modules/mkiv/s-present-green.mkiv b/tex/context/modules/mkiv/s-present-green.mkiv
new file mode 100644
index 000000000..e62257ff3
--- /dev/null
+++ b/tex/context/modules/mkiv/s-present-green.mkiv
@@ -0,0 +1,349 @@
+%D \module
+%D [ file=s-present-green, % was s-pre-02
+%D version=1998.04.21,
+%D title=\CONTEXT\ Style File,
+%D subtitle=Presentation Environment Green,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+\startmodule[present-green]
+
+%D Here is another original presentation style, actually the second one we made.
+%D Not much adaption was needed for \MKIV.
+
+\usemodule[pre-general]
+
+%D \macros
+%D {setupbodyfont, switchtobodyfont, setuplayout}
+%D
+%D At \PRAGMA\ we prefer using the Lucida Bright fonts, but one can of course load
+%D another typeface.
+
+\doifelsemode {asintended} {
+ \setupbodyfont[ludicaot,14.4pt]
+} {
+ \setupbodyfont[pagella,14.4pt]
+}
+
+\setuplayout
+ [style=smallbodyfont]
+
+%D \macros
+%D {setuppapersize, setuplayout}
+%D
+%D The papersize suits the screen dimensions. The layout is rather simple. We use
+%D the whole width of the screen and only have navigational tools at the bottom of
+%D the screen.
+
+\setuppapersize
+ [S6][S6]
+
+\setuplayout
+ [backspace=1cm,
+ topspace=1cm,
+ margin=0pt,
+ header=0pt,
+ footer=0pt,
+ bottomdistance=.875cm,
+ bottom=1cm,
+ width=fit,
+ height=fit]
+
+%D \macros
+%D {setupwhitespace, setuptyping}
+%D
+%D We don't have much height, so we use a more cramped spacing. Verbatim text looks
+%D better when indented.
+
+\setupwhitespace
+ [medium]
+
+\setuptyping
+ [margin=standard]
+
+%D \macros
+%D {definecolor}
+%D
+%D Of course we enable color. We define some logical colors, of which most default
+%D to the same green shade.
+
+\definecolor [BackgroundColor] [r=.8, g=.8, b=.8]
+\definecolor [OrnamentColor] [r= 0, g=.7, b=.4]
+
+%D \macros
+%D {setupinteraction, setupinteractionscreen}
+%D
+%D We still have to enable interaction mode. We go full screen!
+
+\setupinteraction
+ [state=start,
+ color=OrnamentColor,
+ contrastcolor=OrnamentColor]
+
+\setupinteractionscreen
+ [option=max,
+ width=fit,
+ height=fit]
+
+%D \macros
+%D {setupitemize}
+%D
+%D And why not bring some color in itemizations too?
+
+\setupitemize
+ [color=OrnamentColor]
+
+%D \macros
+%D {defineoverlay, setupbackgrounds}
+%D
+%D The navigational elements and the backgrounds are provided by \METAPOST.
+
+\startuniqueMPgraphic{PageBackground}
+ fill unitsquare
+ xyscaled(OverlayWidth,OverlayHeight)
+ withcolor OverlayColor ;
+ draw unitsquare
+ xyscaled(OverlayWidth,OverlayHeight)
+ enlarged (-2*OverlayLineWidth)
+ withpen pencircle scaled OverlayLineWidth
+ withcolor OverlayLineColor ;
+\stopuniqueMPgraphic
+
+\defineoverlay
+ [PageBackground]
+ [\uniqueMPgraphic{PageBackground}]
+
+\setupbackgrounds
+ [page]
+ [background=PageBackground,
+ backgroundcolor=BackgroundColor,
+ rulethickness=.125cm,
+ framecolor=OrnamentColor]
+
+%D \macros
+%D {setuptexttexts}
+%D
+%D By clicking on the text area, one goes to the next page. We hook this feature
+%D into the text backgrounds.
+
+\startuniqueMPgraphic{TextBackground}
+ draw unitsquare
+ xyscaled(OverlayWidth,OverlayHeight)
+ enlarged (4*OverlayLineWidth)
+ withpen pencircle scaled OverlayLineWidth
+ withcolor OverlayLineColor ;
+\stopuniqueMPgraphic
+
+\defineoverlay
+ [TextBackground]
+ [\uniqueMPgraphic{TextBackground}]
+
+\defineoverlay
+ [NextPage]
+ [\overlaybutton{nextpage}]
+
+\setupbackgrounds
+ [text]
+ [background={TextBackground,NextPage},
+ backgroundcolor=BackgroundColor,
+ rulethickness=.0625cm,
+ framecolor=OrnamentColor]
+
+%D \macros
+%D {setupinteractionmenu,startinteractionmenu}
+%D
+%D At the bottom of the screen, we show three buttons. These direct us to the
+%D previous or next jump or exit the document.
+
+\setupMPvariables[RightArrow][height=\bottomheight]
+\setupMPvariables[LeftArrow] [height=\bottomheight]
+\setupMPvariables[Circle] [height=\bottomheight]
+\setupMPvariables[UpArrow] [height=\bottomheight]
+
+\startuniqueMPgraphic{RightArrow}{height}
+ fill righttriangle xysized(\MPvar{height},\MPvar{height})
+ withpen pencircle scaled (\MPvar{height}/5)
+ withcolor "OrnamentColor" ;
+\stopuniqueMPgraphic
+
+\startuniqueMPgraphic{LeftArrow}{height}
+ fill lefttriangle xysized(\MPvar{height},\MPvar{height})
+ withpen pencircle scaled (\MPvar{height}/5)
+ withcolor "OrnamentColor" ;
+\stopuniqueMPgraphic
+
+\startuniqueMPgraphic{Circle}{height}
+ fill fullcircle sized \MPvar{height}
+ withpen pencircle scaled (\MPvar{height}/5)
+ withcolor "OrnamentColor" ;
+\stopuniqueMPgraphic
+
+\startuniqueMPgraphic{UpArrow}{height}
+ fill uptriangle xysized(\MPvar{height},\MPvar{height})
+ withpen pencircle scaled (\MPvar{height}/5)
+ withcolor "OrnamentColor" ;
+\stopuniqueMPgraphic
+
+\setupinteractionmenu
+ [bottom]
+ [state=start,
+ frame=off,
+ width=.3\textwidth,
+ height=\bottomheight]
+
+\setupinteraction
+ [menu=on]
+
+\def\WhateverButton
+ {\doifreferencefoundelse{Whatever}
+ {\raw [Whatever] \uniqueMPgraphic{UpArrow} \\}
+ {}}
+
+\startinteractionmenu[bottom]
+ \but [Topics] \\ % secret button
+ \hfill
+ \WhateverButton % user specific
+ \kern2\bottomheight
+ \raw [previouspage] \uniqueMPgraphic{LeftArrow} \\
+ \kern.5\bottomheight
+ \raw [CloseDocument] \uniqueMPgraphic{Circle} \\
+ \kern.5\bottomheight
+ \raw [nextpage] \uniqueMPgraphic{RightArrow} \\
+ \kern.5\bottomheight
+\stopinteractionmenu
+
+%D \macros
+%D {TitlePage, Topics, Topic, Subject}
+%D
+%D A presentation after loading this module looks like:
+%D
+%D \starttyping
+%D \TitlePage {About Whatever\\Topics}
+%D
+%D \Topics {Todays Talk}
+%D
+%D \Topic {Some topic}
+%D
+%D .....
+%D
+%D \Topic {Next Topic}
+%D
+%D .....
+%D \stoptyping
+
+%D \macros
+%D {StartTitlePage, TitlePage}
+%D
+%D The titlepage is rather simple and can be typeset in two
+%D ways:
+%D
+%D \starttyping
+%D \StartTitlePage
+%D text \\ text \\ text
+%D \StopTitlepage
+%D \stoptyping
+%D
+%D or as one||liner:
+%D
+%D \starttyping
+%D \TitlePage{text\\text\\text}
+%D \stoptyping
+%D
+%D The first alternative can be used for more complicated title pages.
+
+\unexpanded\def\StartTitlePage
+ {\startstandardmakeup
+ \bfd\setupinterlinespace
+ \setupalign[middle]
+ \vfil
+ \let\\=\vfil}
+
+\unexpanded\def\StopTitlePage
+ {\vfil\vfil\vfil
+ \stopstandardmakeup}
+
+\unexpanded\def\TitlePage#1%
+ {\StartTitlePage#1\StopTitlePage}
+
+%D \macros
+%D {definehead}
+%D
+%D The commands \type{\Topic} and \type{\Subject} are defined as copies of head. We
+%D use \type{\Nopic} for internal purposes.
+
+\definehead [Topic] [chapter]
+\definehead [Subject] [section]
+
+\definehead [Nopic] [title]
+
+%D \macros
+%D {setuphead}
+%D
+%D We use our own command for typesetting the titles. We hide sectionnumbers from
+%D viewing. Each topic is followed by a list of subjects that belong to the topic.
+
+\setuphead
+ [Topic, Nopic]
+ [after={\blank[3*medium]},
+ number=no,
+ style=\bfb,
+ page=yes,
+ alternative=middle]
+
+\setuphead
+ [Subject]
+ [after=\blank,
+ number=no,
+ page=yes,
+ continue=no,
+ style=\tfa]
+
+%D \macros
+%D {setuplist}
+%D
+%D When found, the subject list is automatically placed after the topic head.
+
+\setuplist
+ [Topic,Subject]
+ [alternative=g,
+ interaction=all,
+ before=,
+ after=]
+
+\setuplist
+ [Topic]
+ [criterium=all]
+
+\unexpanded\def\Topics#1%
+ {\determinelistcharacteristics[Topic]
+ \doifmode{*list}
+ {\Nopic[Topics]{#1}
+ \startcolumns
+ \placelist[Topic]
+ \stopcolumns}}
+
+\setuplist
+ [Subject]
+ [criterium=Topic]
+
+\unexpanded\def\Subjects
+ {\determinelistcharacteristics[Subject]
+ \doifmode{*list}
+ {\placelist[Subject]}}
+
+\setuphead
+ [Topic]
+ [after={\blank[3*medium]\Subjects}]
+
+\stopmodule
+
+\continueifinputfile{s-present-green.mkiv}
+
+\usemodule[present-common]
+
+\inputpresentationfile{examples/present-green-001.tex}
diff --git a/tex/context/modules/mkiv/s-present-grow.mkiv b/tex/context/modules/mkiv/s-present-grow.mkiv
new file mode 100644
index 000000000..b4971e40f
--- /dev/null
+++ b/tex/context/modules/mkiv/s-present-grow.mkiv
@@ -0,0 +1,171 @@
+%D \module
+%D [ file=s-present-grow, % was s-pre-10
+%D version=unknown,
+%D title=\CONTEXT\ Style File,
+%D subtitle=Presentation Environment Grow,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+%D This style is derived from the ninth style, which was used first at \EUROTEX\ 99
+%D and later at \TUG\ 2000. This alternative builds up a page.
+
+\usemodule[present-windows] % not that much used
+
+\startmodule[present-grow]
+
+%D We use blue colors instead of yellow ones. Since we have used symbolic names, we
+%D can easily overload the existing scheme.
+
+\definecolor[LineColor][r=.40,g=.40,b=1.00]
+
+%D Here we don't use fixed dimensions, but fit the sample windows and derive the
+%D text windows's width from this one.
+
+\setupframedtexts
+ [SampleText]
+ [width=fit,height=fit,
+ background={background,nextpage}]
+
+%D The topic goes to the top right corner of the screen which means that it is
+%D positioned left down to the reference point. Watch how we make data on this layer
+%D (here only the topic but it can be more) persistent.
+
+\setuplayer
+ [topic]
+ [y=0pt,x=\makeupwidth,
+ location=lb,
+ state=repeat,
+ hoffset=-\FrameSkip,
+ voffset=\FrameSkip]
+
+%D Clicking on the page brings us back.
+
+\setupbackgrounds
+ [page]
+ [background={previouspage,color,topic}]
+
+%D All layers end up on the text area. This could have been the page area too since
+%D these have the same dimensions.
+
+\setupbackgrounds
+ [text]
+ [background={common,sample,text}]
+
+%D We overload this one (\MKIV):
+
+\defineoverlay [samepage] [\overlaybutton{nextpage}]
+
+%D Because we build up the text window step by step, we will separate the entries by
+%D white space.
+
+\startsetups [always]
+ \setupwhitespace[big]
+ \setupblank[big]
+\stopsetups
+
+%D The \type {\Topic} commands can be simplified to:
+
+\unexpanded\def\Topic#1%
+ {\resetlayer[topic]
+ \setlayer[topic]{\bfb\setstrut\color[TextColor]{#1}}}
+
+%D We also provide a way to erase the topic.
+
+\unexpanded\def\NoTopic
+ {\resetlayer[topic]}
+
+%D We have to redefine the structuring commands to support the resetting of buffer
+%D counters.
+
+\newcounter\TextN
+
+\unexpanded\def\StartSample
+ {\doglobal\newcounter\TextN
+ \dostartbuffer[sample][StartSample][StopSample]}
+
+\unexpanded\def\StartText
+ {\doglobal\newcounter\TextN
+ \dostartbuffer[text][StartText][StopText]}
+
+\unexpanded\def\StartSubText
+ {\doglobal\increment\TextN
+ \dostartbuffer[text-\TextN][StartSubText][StopSubText]}
+
+\unexpanded\def\StopText
+ {\startstandardmakeup
+ \DoSampleText{text}{common}{nextpage}
+ \stopstandardmakeup}
+
+\unexpanded\def\StopSubText
+ {\startstandardmakeup
+ \DoSampleText{text}{common}{nextpage}
+ \stopstandardmakeup}
+
+%D The \type {\DoSampleText} command is adapted to support addition of subtexts
+%D (each subtext goes into its own buffer).
+
+\unexpanded\def\DoSampleText#1#2#3%
+ {\setupframedtexts[SampleText][background={background,#3}]
+ \bgroup
+ \setups[#1]%
+ \setups[always]%
+ \setbox\nextbox=\hbox
+ {\startSampleText[none]
+ \getbuffer[#1]\par
+ \doif{#1}{text}
+ {\dorecurse{\TextN}{\getbuffer[text-\recurselevel]\par}}
+ \stopSampleText}
+ \xdef\SampleTextWidth{\the\wd\nextbox}
+ \setlayer[#2]{\box\nextbox}%
+ \egroup}
+
+%D Since we are no longer swapping windows, we end up with a much simplier \type
+%D {\Stopidea} macro. We don't reset samples at the inner level.
+
+\unexpanded\def\StartIdea
+ {\bgroup
+ \let\StopSample \relax
+ \let\StopText \relax
+ \let\StopSubText\relax
+ \def\StartSample{\dostartbuffer[sample][StartSample][StopSample]}}
+
+\unexpanded\def\StopIdea
+ {\startstandardmakeup
+ \DoSampleText{sample}{sample}{nextpage}
+ \SetTextWidth
+ \DoSampleText{text} {text} {nextpage}
+ \stopstandardmakeup
+ \egroup}
+
+%D Here we determine the width of the text window. It is derived from the width of
+%D the sample and stays the same within a sequence.
+
+\unexpanded\def\SetTextWidth
+ {\ifnum\TextN<1 % yes or no, may change
+ \scratchdimen=\makeupwidth
+ \advance\scratchdimen by -\SampleTextWidth
+ \advance\scratchdimen by \FrameSkip
+ \xdef\SampleWidth{\the\scratchdimen}%
+ \fi
+ \setupframedtexts
+ [SampleText]
+ [width=\SampleWidth]}
+
+%D We use the (already implemented) second alternative of the titlepage graphic.
+%D Please don't change this.
+
+\defineoverlay[joke] [\useMPgraphic{joke}{n=1}] % not to be changed !
+
+\stopmodule
+
+\continueifinputfile{s-present-grow.mkiv}
+
+\usemodule[present-common]
+
+\inputpresentationfile{examples/present-grow-001.tex}
+
diff --git a/tex/context/modules/mkiv/s-present-organic.mkiv b/tex/context/modules/mkiv/s-present-organic.mkiv
new file mode 100644
index 000000000..657b786f2
--- /dev/null
+++ b/tex/context/modules/mkiv/s-present-organic.mkiv
@@ -0,0 +1,335 @@
+%D \module
+%D [ file=s-present-organic, % s-pre-19,
+%D version=2000.07.31,
+%D title=\CONTEXT\ Style File,
+%D subtitle=Presentation Environment Organic,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+\startmodule[present-organic]
+
+%D This style is made in the process or writing the \METAFUN\ manual. It exploits a
+%D few tricks, like graphics calculated using positional information. It also uses
+%D the (at that moment) new menu list placement alternative. If you forget about the
+%D definition of the button shapes, which is complicated in any system, this style
+%D is not even that hard to follow. Watch how the left side of the buttons follow
+%D the right side of the text graphic.
+%D
+%D While playing bit with this style, the random alternative made me think of those
+%D organic building with non equal windows (we have a few in The Netherlands), so I
+%D decided to label this style as \type {pre-organic}.
+%D
+%D At the end of this file, there is a small test file, so when you process this
+%D file with \TEXEXEC\ and the options \type {--mode=demo} and \type {--pdf}, you
+%D will get a demo document.
+%D
+%D We use one of the standard screen \quote {paper} sizes, and map it onto the same
+%D size, so that we get a nicely cropped page.
+
+\setuppapersize
+ [S6][S6]
+
+%D Like in the \METAFUN\ manual, we use the Palatino as main bodyfont. This font is
+%D quite readable on even low resolution screens, although I admit that this style
+%D is developed using an $1400\times1050$ pixel LCD screen, so I may be biased.
+
+\setupbodyfont[pagella]
+
+%D The layout specification sets up a text area and a right edge area where the
+%D menus will go. Watch the rather large edge distance. By setting the header and
+%D footer dimensions to zero, we automatically get rid of page body ornaments, like
+%D the pagenumber.
+
+\setuplayout
+ [topspace=48pt,
+ backspace=48pt,
+ cutspace=12pt,
+ width=400pt,
+ margin=0cm,
+ rightedge=88pt,
+ rightedgedistance=48pt,
+ header=0cm,
+ footer=0cm,
+ height=middle]
+
+%D We use a moderate, about a line height, interparagraph white space.
+
+\setupwhitespace
+ [big]
+
+%D Of course we use colors, since on computer displays they come for free.
+
+\definecolor [red] [r=.75]
+\definecolor [yellow] [r=.75,g=.75]
+\definecolor [gray] [s=.50]
+\definecolor [white] [s=.85]
+
+\definecolor [PageColor] [yellow]
+\definecolor [TextColor] [white]
+\definecolor [OrnamentColor] [red]
+\definecolor [InteractionColor] [red]
+\definecolor [ContrastColor] [gray]
+
+%D This is an interactive document, so we enable interaction. In this style, we
+%D disable the viewer's \quote {highlight a hyperlink when it's clicked on} feature.
+%D We will use a menu, so we enable menus. Later we will see the contract color
+%D |<|hyperlinks gets that color when we are already on the location|>| in action.
+
+\setupinteraction
+ [state=start,
+ click=off,
+ color=InteractionColor,
+ contrastcolor=ContrastColor,
+ menu=on]
+
+%D The menu itself is set up as follows. Because we will calculate menubuttons based
+%D on their position on the page, we have to keep track of the positions. Therefore,
+%D we set the \type {position} variable to \type {yes}.
+
+\setupinteractionmenu
+ [right]
+ [frame=off,
+ position=yes,
+ align=middle,
+ topoffset=.75cm, % watch out, these are negative in mkii
+ bottomoffset=.75cm, % watch out, these are negative in mkii
+ color=gray,
+ contrastcolor=gray,
+ style=bold,
+ before=,
+ after=]
+
+%D The menu content is rather sober: a list of topics (later we will define the
+%D command that generates topic entries), and a close button.
+
+\startinteractionmenu[right]
+ \placelist[Topic][alternative=right]
+ \vfill
+ \but [CloseDocument] close \\
+\stopinteractionmenu
+
+%D We have now arived at the more interesting part of the style definition: the
+%D graphic that goes in the page background. Because this graphic will change, we
+%D define a usable \METAPOST\ graphic. Page backgrounds are recalculated each page,
+%D opposite to the other backgrounds that are calculated when a new background is
+%D defined, or when repetitive calculation is turned on.
+
+\setupbackgrounds
+ [page]
+ [background=page]
+
+\defineoverlay
+ [page]
+ [\useMPgraphic{page}]
+
+\setupMPvariables
+ [page]
+ [alternative=3]
+
+\startuseMPgraphic{page}
+
+ \includeMPgraphic{rightsuperbutton}
+
+ StartPage ;
+
+ path p, q ; pickup pencircle scaled 3pt ;
+
+ p := Field[Text][Text] enlarged 36pt superellipsed .90 ;
+
+ fill Page withcolor \MPcolor{PageColor} ;
+ fill p withcolor \MPcolor{TextColor} ;
+ draw p withcolor \MPcolor{OrnamentColor} ;
+
+ p := Field[Text][Text] enlarged 48pt superellipsed .90 ;
+
+ def right_menu_button (expr nn, rr, pp, xx, yy, ww, hh, dd) =
+ if (pp>0) and (rr>0) :
+ q := rightsuperbutton(p,xx,yy,RightEdgeWidth,hh) ;
+ fill q withcolor \MPcolor{TextColor} ;
+ draw q withcolor if rr=2 : \MPcolor{ContrastColor}
+ else : \MPcolor{InteractionColor} fi ;
+ fi ;
+ enddef ;
+
+ \MPmenubuttons{right}
+
+ StopPage ;
+\stopuseMPgraphic
+
+\startuseMPgraphic{page}
+
+ \includeMPgraphic{rightsuperbutton}
+
+ StartPage ;
+
+ numeric alternative, seed, superness, squeezeness, randomness ;
+ path p, q ; transform t ;
+
+ alternative := \MPvar{alternative} ;
+ seed := uniformdeviate 100 ;
+
+ if alternative > 10 :
+ superness := .85 + ((\realfolio-1)/max(\lastpage,1)) * .15 ;
+ squeezeness := 12pt - ((\realfolio-1)/max(\lastpage,1)) * 10pt ;
+ else :
+ superness := .90 ;
+ squeezeness := 12pt ;
+ fi ;
+
+ randomness := squeezeness ;
+
+ alternative := alternative mod 10 ;
+
+ t := identity if alternative=3: shifted (9pt,-9pt) fi ;
+
+ % first we draw the shape that surrounds the text
+
+ randomseed := seed ;
+
+ p := Field[Text][Text] enlarged if
+ alternative = 1 : 36pt superellipsed superness elseif
+ alternative = 2 : 36pt squeezed squeezeness elseif
+ alternative = 3 : 36pt randomized randomness else
+ : 36pt fi ;
+
+ pickup pencircle scaled 3pt ;
+
+ fill Page withcolor \MPcolor{PageColor} ;
+ fill p withcolor \MPcolor{TextColor} ;
+ draw p withcolor \MPcolor{OrnamentColor} ;
+
+ % we set p to the wider shape from which we will chip off pieces
+
+ randomseed := seed ;
+
+ p := ( Field[Text][Text] enlarged if
+ alternative = 1 : 48pt superellipsed superness elseif
+ alternative = 2 : 48pt squeezed squeezeness elseif
+ alternative = 3 : 36pt randomized randomness else
+ : 48pt fi ) transformed t ;
+
+ % calls to *_menu_button are generated automatically ...
+
+ vardef right_menu_button (expr nn, rr, pp, xx, yy, ww, hh, dd) =
+ save q ; path q ;
+ if (pp>0) and (rr>0) :
+ q := rightsuperbutton(p,xx,yy,RightEdgeWidth,hh) ; % \MPw{menu:right:\realfolio}
+ fill q withcolor \MPcolor{TextColor} ;
+ draw q withcolor if rr=2 : \MPcolor{ContrastColor}
+ else : \MPcolor{InteractionColor} fi ;
+ fi ;
+ enddef ;
+
+ % ... and inserted when the graphic data is flushed here ...
+
+ \MPmenubuttons{right}
+
+ StopPage ;
+\stopuseMPgraphic
+
+\startuseMPgraphic{rightsuperbutton}
+
+ vardef rightsuperbutton (expr pat, xpos, ypos, wid, hei) =
+
+ save p, ptop, pbot, t, b, edge, shift, width, height ;
+ path p, ptop, pbot ; pair t, b ; numeric edge, shift, width, height ;
+
+ edge := xpos + wid ; shift := ypos + hei ;
+
+ p := rightpath pat ;
+
+ ptop := ((-infinity,shift)--(edge,shift)) ;
+ pbot := ((-infinity,shift-hei)--(edge,shift-hei)) ;
+
+ t := p intersection_point ptop ;
+ b := p intersection_point pbot ;
+
+ p := subpath(0,xpart (p intersectiontimes ptop)) of p ;
+ p := subpath(xpart (p intersectiontimes pbot),length(p)) of p ;
+
+ (p -- t -- point 1 of ptop &
+ point 1 of ptop -- point 1 of pbot &
+ point 1 of pbot -- b
+ -- cycle)
+
+ enddef ;
+
+\stopuseMPgraphic
+
+%D Topics are identified with \type {\Topic}, which is an instance of chapter
+%D headings. The number is made invisible. Since it still is a numbered section
+%D header, \CONTEXT\ will write the header to the table of contents.
+
+\definehead
+ [Topic]
+ [chapter]
+
+\setuphead
+ [Topic]
+ [number=no]
+
+%D We will use a bold font in the table of contents. We also force a complete
+%D list.
+
+\setuplist
+ [Topic]
+ [criterium=all,
+ style=bold,
+ before=,
+ after=]
+
+%D The \type {\TitlePage} macro looks horrible, because we want to keep the
+%D interface simple: a list of small sentences, separated by \type {\\}.
+
+\unexpanded\def\StartTitlePage
+ {\startstandardmakeup
+ \switchtobodyfont[big]
+ \def\\{\vfill\bfb\let\\=\par}
+ \bfd\setupinterlinespace\gray
+ \vskip.5cm\relax}
+
+\unexpanded\def\StopTitlePage
+ {\\ % the \\ is really needed
+ \vskip.5cm\relax
+ \stopstandardmakeup}
+
+\unexpanded\def\TitlePage#1%
+ {\StartTitlePage#1\StopTitlePage}
+
+%D A couple of goodies:
+
+\unexpanded\def\Subject {\Topic}
+\unexpanded\def\Topics #1{}
+\unexpanded\def\Subjects {}
+
+\startsetups document:start
+ \StartTitlePage
+ \documentvariable{title}
+ \doifsomething {\documentvariable{subtitle}} {
+ \\
+ \documentvariable{subtitle}
+ }
+ \doifsomething {\documentvariable{location}} {
+ \\
+ \documentvariable{location}
+ }
+ \StopTitlePage
+\stopsetups
+
+\startsetups document:stop
+ %
+\stopsetups
+
+\stopmodule
+
+\continueifinputfile{s-present-organic.mkiv}
+
+\usemodule[present-common]
+
+\inputpresentationfile{examples/present-organic-001.tex}
+
diff --git a/tex/context/modules/mkiv/s-present-original.mkiv b/tex/context/modules/mkiv/s-present-original.mkiv
new file mode 100644
index 000000000..809f7b2cb
--- /dev/null
+++ b/tex/context/modules/mkiv/s-present-original.mkiv
@@ -0,0 +1,397 @@
+%D \module
+%D [ file=s-present-original, % was s-pre-01
+%D version=1997.07.22,
+%D title=\CONTEXT\ Style File,
+%D subtitle=Presentation Environment Original,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+%D This environment can be used to typeset interactive presentations. This module
+%D was first used at the 1997 \TUG\ meeting. The \MKIV\ variant is mostly the same
+%D but we adapted the colors a bit.
+
+\usemodule[present-general]
+
+\startmodule[present-original]
+
+%D \macros
+%D {language}
+%D
+%D Because this module is defined in english, we default to the english hyphenation
+%D patterns and labels too. This is default anyway.
+
+\mainlanguage
+ [en]
+
+%D \macros
+%D {setupbodyfont,setuplayout}
+%D
+%D For screen reading, a Lucida Bright font looks nice. We use a 14.4 point bodyfont
+%D for the main text, but switch back to 12 points for ornaments.
+
+\doifelsemode {asintended} {
+ \setupbodyfont[ludicaot,14.4pt]
+} {
+ \setupbodyfont[pagella,14.4pt]
+}
+
+\setuplayout
+ [style=smallbodyfont]
+
+\setupalign
+ [tolerant,stretch]
+
+%D \macros
+%D {definecolor}
+%D
+%D Screen presentations without color just look dull, so we enable color support. We
+%D define ourselves a yellowish backgroundcolor and a not too dark blue
+%D interactioncolor.
+
+% \definecolor [BackgroundColor] [r=1, g=1, b=.7]
+% \definecolor [InteractionColor] [r=.1, g=.5, b=.8]
+% \definecolor [ContrastColor] [r=.9, g=.5, b=.2]
+
+\definecolor [BackgroundColor] [r=.7, g=.7, b=.3]
+\definecolor [InteractionColor] [r=.1, g=.5, b=.8]
+\definecolor [ContrastColor] [r=.9, g=.5, b=.2]
+
+%D \macros
+%D {setuppapersize,setuplayout,setupinteractionscreen}
+%D
+%D We use a nice large screen, and dedicate the right edge and bottom part to
+%D navigational tools. We automatically set the width and height of the page and
+%D start up full screen.
+
+\setuppapersize
+ [S6][S6]
+
+\setuplayout
+ [topspace=12pt,
+ header=0pt,
+ footer=0pt,
+ height=402pt, % 450 - 12 - 15 - 12 - 12 + 3
+ bottomdistance=15pt,
+ bottom=12pt,
+ backspace=12pt,
+ margin=0pt,
+ width=fit,
+ edgedistance=12pt,
+ rightedge=96pt]
+
+\setupinteractionscreen
+ [option=max]
+
+%D \macros
+%D {setupbackgrounds}
+%D
+%D We set the pagecolor to yellow except the part of the screen that is used to
+%D display the running text. By seting the offset to 3pt the text will not touch the
+%D yellow parts. We do not set the depth.
+
+\setupbackgrounds
+ [page]
+ [background=color,
+ backgroundcolor=BackgroundColor]
+
+\setupbackgrounds
+ [text][text]
+ [background=color,
+ backgroundcolor=white,
+ backgroundoffset=3pt]
+
+%D I considered the next setup too, but finaly decided to
+%D comment it out.
+%D
+%D \starttyping
+%D \setupbackgrounds
+%D [bottom][text]
+%D [frame=on,
+%D framecolor=white]
+%D \stoptyping
+
+%D \macros
+%D {setupinteraction}
+%D
+%D We did not enable interactive text support yet, so let's do that now. We force
+%D page reference to circumvent problems with named destinations in buggy viewers.
+
+\setupinteraction
+ [page=yes,
+ color=InteractionColor,
+ contrastcolor=ContrastColor,
+ menu=on,
+ state=start]
+
+%D \macros
+%D {setupinteractionmenu,startinteractionmenu}
+%D
+%D At the bottom of the screen we show two navigational bars. At the left we show
+%D the subpage bar, at the right we use a non default backward|/|forward bar.
+
+\setupinteractionmenu
+ [bottom]
+ [leftoffset=3pt,
+ rightoffset=3pt]
+
+\startinteractionmenu[bottom]
+ \startcom \InteractionBar \stopcom
+ \hfill
+ \startcom \InteractionButtons \stopcom
+\stopinteractionmenu
+
+%D \macros
+%D {interactionbar}
+%D
+%D The left bar gets a white border (on the yellow background). Because we don't
+%D want to typeset an empty frame when no subpage bar is shown, we check for the
+%D number of subpages.
+
+\unexpanded\def\InteractionBar
+ {\ifnum\nofsubpages>\plusone
+ \framed
+ [framecolor=white,
+ rulethickness=1pt,
+ height=\bottomheight,
+ strut=no]
+ {\interactionbar[alternative=f,width=.5\makeupwidth,height=1ex]}
+ \fi}
+
+%D \macros
+%D {setupinteractionbar, interactionbuttons}
+%D
+%D The right hand buttons enable us to jump backward and forward, as well as to the
+%D previous and next jump. We also enable to close the presentation.
+
+\setupinteractionbar
+ [framecolor=white,
+ rulethickness=1pt,
+ height=\bottomheight,
+ strut=no]
+
+\unexpanded\def\InteractionButtons
+ {\interactionbuttons
+ [width=15em,
+ framecolor=white,
+ rulethickness=1pt,
+ height=\bottomheight,
+ strut=no,
+ distance=.5em]
+ [PreviousJump,NextJump,
+ firstpage,
+ firstsubpage,previouspage,nextpage,lastsubpage,
+ lastpage,
+ CloseDocument]}
+
+%D \macros
+%D {StartTitlePage, TitlePage}
+%D
+%D The titlepage is rather simple and can be typeset in two ways:
+%D
+%D \starttyping
+%D \StartTitlePage
+%D text \\ text \\ text
+%D \StopTitlepage
+%D \stoptyping
+%D
+%D or more straightforward:
+%D
+%D \starttyping
+%D \TitlePage{text\\text\\text}
+%D \stoptyping
+%D
+%D The first alternative can be used for more complicated title pages.
+
+\unexpanded\def\StartTitlePage
+ {\startstandardmakeup
+ \bfd
+ \setupinterlinespace
+ \setupalign[middle]
+ \vfil
+ \let\\=\vfil}
+
+\unexpanded\def\StopTitlePage
+ {\vfil\vfil\vfil
+ \stopstandardmakeup}
+
+\unexpanded\def\TitlePage#1%
+ {\StartTitlePage#1\StopTitlePage}
+
+%D \macros
+%D {TitlePage, Topics, Topic, Subject}
+%D
+%D A presentation after loading this module looks like:
+%D
+%D \starttyping
+%D \TitlePage {About Whatever\\Topics}
+%D
+%D \Topics {Todays Talk}
+%D
+%D \Topic {Some topic}
+%D
+%D \Subject {Alfa}
+%D
+%D .....
+%D
+%D \Subject {Beta}
+%D
+%D .....
+%D \stoptyping
+
+%D \macros
+%D {definehead}
+%D
+%D The commands \type{\Topic} and \type{\Subject} are defined as copies of head. We
+%D use \type{\Nopic} for internal purposes.
+
+\definehead [Topic] [chapter]
+\definehead [Subject] [section]
+
+\definehead [Nopic] [title]
+
+%D \macros
+%D {setuphead}
+%D
+%D Because chapters and sections do not make sense in presentations, we use our own
+%D command for typesetting the titles. Sectionnumbers are of course hidden from
+%D viewing. Each topic is followed by a list of subjects that belong to the topic.
+
+\setuphead
+ [Topic,Nopic,Subject]
+ [command=\HeadLine,
+ page=yes,
+ style=\bfb,
+ after=\blank,
+ sectionnumber=no]
+
+\setuphead
+ [Topic]
+ [after=\PlaceSubjectList]
+
+\setuphead
+ [Subject]
+ [continue=no]
+
+%D \macros
+%D {framed, midalined}
+%D
+%D The command used to typeset the head lines is rather simple. We just center the
+%D framed title. The frame macro optimizes the alignment and at the same time
+%D enables us to typeset a nice colored rule.
+
+\unexpanded\def\HeadLine#1#2%
+ {\midaligned
+ {\framed
+ [framecolor=BackgroundColor,
+ rulethickness=1pt,
+ width=.8\hsize,
+ align=middle,
+ strut=no]
+ {#2}}}
+
+%D \macros
+%D {setuplist}
+%D
+%D The subject list is automatically placed. We center each subject line by using
+%D one of the default alternatives (g). We could have said:
+%D
+%D \starttyping
+%D \setuplist
+%D [Subject]
+%D [alternative=none,
+%D command=\SubjectListLine,
+%D interaction=all]
+%D
+%D \def\SubjectListLine#1#2#3%
+%D {\midaligned{#2}}
+%D \stoptyping
+%D
+%D But why should we complicate things when we can use alternative~\type{g}. The
+%D test is only needed if one does not automatically goes a new page with each
+%D subject.
+
+\unexpanded\def\PlaceSubjectList
+ {\blank
+ \determinelistcharacteristics[Subject]
+ \doifmode{*list}{\placelist[Subject]}}
+
+\setuplist
+ [Subject,Topic]
+ [alternative=g,
+ interaction=all,
+ before=,
+ after=]
+
+% %D \macros
+% %D {setuptexttexts}
+% %D
+% %D The topics will be listed in the right edge, using:
+%
+% \setuptexttexts
+% [edge]
+% [][\TopicList]
+
+%D \macros
+%D {setuplist, placelist,startinteractionmenu}
+%D
+%D The actual topic list is typeset using a \type{\vbox}. We have to specify
+%D \type{criteriumcriterium=all} because otherwise no list will be typeset. (By
+%D default lists are typeset locally.)
+
+\startinteractionmenu[right]
+ \placelist
+ [Topic]
+ [alternative=f, % command, % none,
+ maxwidth=\hsize,
+ width=\hsize,
+ offset=0pt,
+ criterium=all,
+ align=left,
+ style=\smallbodyfont\bfx]
+\stopinteractionmenu
+
+\unexpanded\def\Topics#1% temporary hack
+ {\Nopic{#1}
+ \placelist[Topic][criterium=all]}
+
+\unexpanded\def\Subjects
+ {}
+
+%D \macros
+%D {setupbackgrounds, overlaybutton}
+%D
+%D During a presentation, we want to use the cursor to point to parts of the text.
+%D Furthermore we want to be able to jump to the next page, without the need to move
+%D the cursor on buttons. Therefore we make the text part of the screen into an
+%D invisible button.
+%D
+%D In \MKII\ we put a button in he texttextsm here we just use an extra background.
+
+\defineoverlay[nextpage][\overlaybutton{nextpage}]
+
+\setupbackgrounds
+ [text][text]
+ [background={color,nextpage}]
+
+%D \macros
+%D {setupsubpagenumber}
+%D
+%D The left bottom navigation bar shows the subpages, which will be counted by text.
+%D One can change this in the preentation itself by saying \type {[way=byTopic]}.
+
+\setupsubpagenumber
+ [way=bytext, % byTopic,
+ state=start]
+
+\stopmodule
+
+\continueifinputfile{s-present-original.mkiv}
+
+\usemodule[present-common]
+
+\inputpresentationfile{examples/present-original-001.tex}
diff --git a/tex/context/modules/mkiv/s-present-ovals.mkiv b/tex/context/modules/mkiv/s-present-ovals.mkiv
new file mode 100644
index 000000000..45af6c823
--- /dev/null
+++ b/tex/context/modules/mkiv/s-present-ovals.mkiv
@@ -0,0 +1,94 @@
+%D \module
+%D [ file=s-present-ovals,
+%D version=2015.04.20,
+%D title=\CONTEXT\ Style File,
+%D subtitle=Presentation Environment Ovals,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+%D This style was made for some of the font and language related presentations at
+%D Bacho\TeX\ 2015. It's a bit boring but it suits simple presentations. It provides
+%D no structure as each page content is kind of special.
+
+\startmodule[s-present-ovals]
+
+\setuppapersize[S6]
+
+\definecolor[maincolor] [darkred]
+\definecolor[othercolor][maincolor]
+
+\startuseMPgraphic{page}
+
+ fill Page enlarged 2mm withcolor .5[white,\MPcolor{othercolor}] ;
+
+ if NOfPages > 1 :
+
+ numeric PageFraction ; PageFraction := (RealPageNumber-1) / (NOfPages-1) ;
+ numeric WidthDelta ; WidthDelta := 2 * PaperWidth / 10 ;
+ numeric HeightDelta ; HeightDelta := 2 * PaperHeight / 10 ;
+ numeric WidthOffset ; WidthOffset := WidthDelta + PageFraction*(PaperWidth - 2WidthDelta ) ;
+ numeric HeightOffset ; HeightOffset := HeightDelta + PageFraction*(PaperHeight - 2HeightDelta) ;
+
+ fill
+ (ulcorner Page) shifted (WidthOffset,0) ..
+ (urcorner Page) shifted (0,-HeightOffset) ..
+ (lrcorner Page) shifted (-WidthOffset,0) ..
+ (llcorner Page) shifted (0,HeightOffset) ..
+ cycle withcolor \MPcolor{maincolor} ;
+
+ clip currentpicture to Page ;
+
+ fi ;
+
+\stopuseMPgraphic
+
+% e-mess has always been okay by definition which makes it easier to blame generators
+
+\defineoverlay
+ [page]
+ [\useMPgraphic{page}]
+
+\setupbackgrounds
+ [page]
+ [background=page]
+
+\setupalign
+ [middle,broad]
+
+\setupcolors
+ [textcolor=white]
+
+\setupbodyfont
+ [pagella,17.3pt]
+
+\setuplayout
+ [height=middle,
+ width=middle,
+ topspace=.05\paperheight,
+ backspace=.15\paperwidth,
+ header=0pt,
+ footer=0pt]
+
+\setupwhitespace
+ [line]
+
+\setuphead
+ [title]
+ [style=\bfb,
+ alternative=middle,
+ before=,
+ number=no]
+
+\stopmodule
+
+\continueifinputfile{s-present-ovals.mkiv}
+
+\usemodule[present-common]
+
+\inputpresentationfile{bachotex/2015/bachotex-2015-ligatures.tex}
+%inputpresentationfile{bachotex/2015/context-2015-status.tex}
diff --git a/tex/context/modules/mkiv/s-present-overlap.mkiv b/tex/context/modules/mkiv/s-present-overlap.mkiv
new file mode 100644
index 000000000..053455b4b
--- /dev/null
+++ b/tex/context/modules/mkiv/s-present-overlap.mkiv
@@ -0,0 +1,233 @@
+%D \module
+%D [ file=s-present-overlap, % was s-pre-62,
+%D version=2005.03.04,
+%D title=\CONTEXT\ Style File,
+%D subtitle=Presentation Environment Overlap,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+\usemodule[present-stepwise]
+
+\startmodule[present-overlap]
+
+\doifmodeelse {atpragma} {
+
+ \usetypescriptfile
+ [type-ghz]
+
+ \definetypeface[mainface][rm][serif][melior] [default][encoding=texnansi]
+ \definetypeface[mainface][tt][mono] [modern] [default][encoding=texnansi,rscale=1.05]
+ \definetypeface[mainface][ss][serif][melior] [default][encoding=texnansi]
+ \definetypeface[mainface][mm][math] [palatino][default][encoding=texnansi,rscale=0.95]
+
+ \setupbodyfont
+ [mainface,14.4pt]
+
+} {
+
+ \setupbodyfont[dejavu,14.4pt]
+
+}
+
+\setuppapersize
+ [S6][S6]
+
+\setvariables[layout][dx=0,dy=1,nx=2,ny=2,step=64]
+
+\definemeasure[layoutwd][\dimexpr\paperwidth /\getvariable{layout}{step}\relax]
+\definemeasure[layoutht][\dimexpr\paperheight/\getvariable{layout}{step}\relax]
+
+\setuplayout
+ [ width=middle,
+ height=middle,
+ header=0pt,
+ footer=0pt,
+ margin=0pt,
+ backspace=5\measured{layoutwd},
+ topspace=5\measured{layoutht}]
+
+\definelayout
+ [step]
+ [ backspace=\numexpr2+ \getvariable{layout}{dx}\relax\measured{layoutwd},
+ cutspace=\numexpr3+\getvariable{layout}{nx}-\getvariable{layout}{dx}\relax\measured{layoutwd},
+ topspace=\numexpr2+ \getvariable{layout}{dy}\relax\measured{layoutht},
+ bottomspace=\numexpr3+\getvariable{layout}{ny}-\getvariable{layout}{dy}\relax\measured{layoutht}]
+
+\definecolor[layout:left] [t=.5,a=1,b=1]
+\definecolor[layout:right] [t=.5,a=1,r=1]
+\definecolor[layout:top] [t=.5,a=1,g=1]
+\definecolor[layout:bottom][t=.5,a=1,y=1]
+\definecolor[layout:page] [s=.75]
+
+\definehspace[menu][\measured{layoutwd}]
+
+\setupinteraction
+ [state=start,
+ click=off,
+ style=,
+ color=interactioncolor,
+ contrastcolor=interactioncolor]
+
+\setupinteractionscreen
+ [option=max]
+
+\setupbuttons
+ [color=maincolor,
+ contrastcolor=maincolor,
+ style=\tf, % acceptable
+ height=2\measure{layoutht},
+ width=2\measure{layoutwd},
+ offset=overlay,
+ frame=off]
+
+\definecolor[interactioncolor][darkgray]
+\definecolor[maincolor] [lightgray]
+
+\setuptexttexts
+ []
+ [\vbox to \textheight{\vfill\hfill\setups{menu:content}}]
+
+\startsetups menu:content
+
+ \button{\symbol[firstpage]}[firstpage]
+ \hspace[menu]
+ \button{\symbol[previouspage]}[previouspage]
+ \hspace[menu]
+ \button{\StartBusy\symbol[PauseRendering]\StopBusy}[InvokeStepper]
+ \hspace[menu]
+ \button{\symbol[nextpage]}[nextpage]
+ \hspace[menu]
+ \button{\symbol[lastpage]}[lastpage]
+ \hspace[menu]
+ \button{\symbol[CloseDocument]}[CloseDocument]
+
+\stopsetups
+
+\startuseMPgraphic{page}{step}
+ StartPage ;
+ numeric dx ; dx := PaperWidth /\MPvar{step} ;
+ numeric dy ; dy := PaperHeight/\MPvar{step} ;
+ fill Page withcolor .5white ;
+ fill
+ ulcorner Page -- urcorner Page --
+ urcorner Page shifted (0,-TopSpace+dy) -- ulcorner Page shifted (0,-TopSpace+dy) -- cycle
+ withcolor "layout:top" ;
+ fill
+ llcorner Page -- lrcorner Page --
+ lrcorner Page shifted (0,BottomSpace-dy) -- llcorner Page shifted (0,BottomSpace-dy) -- cycle
+ withcolor "layout:bottom" ;
+ fill
+ ulcorner Page -- llcorner Page --
+ llcorner Page shifted (BackSpace-dx,0) -- ulcorner Page shifted (BackSpace-dx,0) -- cycle
+ withcolor "layout:left" ;
+ fill
+ urcorner Page -- lrcorner Page --
+ lrcorner Page shifted (-CutSpace+dx,0) -- urcorner Page shifted (-CutSpace+dx,0) -- cycle
+ withcolor "layout:right" ;
+ fill Field[Text][Text] enlarged (dx,dy) withcolor white ;
+ fill Field[Text][Text] enlarged (dx,dy) withcolor "layout:page" ;
+ StopPage ;
+\stopuseMPgraphic
+
+\defineoverlay[page][\useMPgraphic{page}{step=\getvariable{layout}{step}}]
+
+\setupbackgrounds
+ [page]
+ [background=page]
+
+\setupcolors
+ [state=start]
+
+\startsetups nextstep
+ % pagebreak handlers are grouped, so we need to set global
+ \ifnum\getvariable{layout}{dx}=\getvariable{layout}{nx}\relax
+ \ifnum\getvariable{layout}{dy}=\getvariable{layout}{ny}\relax
+ \setxvariables[layout][dy=1]
+ \else
+ \setxvariables[layout][dy=\the\numexpr\getvariable{layout}{dy}+1\relax]
+ \fi
+ \setxvariables[layout][dx=1]
+ \else
+ \setxvariables[layout][dx=\the\numexpr\getvariable{layout}{dx}+1\relax]
+ \fi
+ % global anyway
+ \setuplayout[step]
+\stopsetups
+
+\appendtoks
+ \definefont[ChapterTitleFont][SerifBold*default sa 2]
+ \NormalizeFontHeight \SubTitleFont {\setstrut\strut\quad} {3\lineheight} {SerifBold*default}
+ \NormalizeFontHeight \ChapterNumberFont {XVI} {4\lineheight} {SerifBold*default}
+\to \everystarttext
+
+\setupsection
+ [section-2]
+ [bodypartconversion=Romannumerals]
+
+\installpagebreakhandler {step} {\setups{nextstep}}
+
+\definepagebreak[chapter][yes,step]
+
+\setuphead
+ [chapter]
+ [page=chapter,
+ command=\MyChapterCommand,
+ after=\nowhitespace]
+
+\definehead[Topic][chapter]
+\definehead[Nopic][title]
+
+\setuphead[chapter,Topic,Nopic]
+ [numberstyle=\ChapterNumberFont,
+ textstyle=\ChapterTitleFont,
+ numbercolor=lightgray,
+ textcolor=darkgray]
+
+\unexpanded\def\MyChapterCommand#1#2%
+ {\hbox \bgroup % we need to nil the strut added by the headplacement
+ \setupframed[frame=off,lines=3,offset=overlay]%
+ \rlap{\hskip2\lineheight\framed{\setnostrut#1}}%
+ \framed{#2}%
+ \egroup}
+
+\setupitemize
+ [each]
+ [R,broad]
+ [stopper=,
+ color=lightgray]
+
+\startsetups document:start
+
+ \startstandardmakeup[headerstate=high,textstate=stop]
+
+ \setupalign[middle]
+
+ \vfil
+ \startcolor[darkgray]
+ \dontleavehmode\scale[width=.9\textwidth]{\bf\setstrut\strut\documentvariable{title}}
+ \vfil
+ \dontleavehmode\scale[width=.7\textwidth]{\bf\setstrut\strut\documentvariable{subtitle}}
+ \vfil \vfil \vfil
+ \dontleavehmode\scale[width=.5\textwidth]{\bf\setstrut\strut\documentvariable{location}}
+ \stopcolor
+ \vfil \vfil \vfil
+
+ \stopstandardmakeup
+
+\stopsetups
+
+\stopmodule
+
+\continueifinputfile{s-present-overlap.mkiv}
+
+\usemodule[present-common]
+
+\inputpresentationfile{context/2011/context-2011-mathml-update.tex}
+%\inputpresentationfile{context/2011/context-2011-metapost-how-we-adapt.tex}
+%\inputpresentationfile{context/2011/context-2011-ebook-export.tex}
+%\inputpresentationfile{context/2011/context-2011-sorting-registers.tex}
diff --git a/tex/context/modules/mkiv/s-present-phone.mkiv b/tex/context/modules/mkiv/s-present-phone.mkiv
new file mode 100644
index 000000000..d041ad822
--- /dev/null
+++ b/tex/context/modules/mkiv/s-present-phone.mkiv
@@ -0,0 +1,108 @@
+%D \module
+%D [ file=s-present-phone,
+%D version=2016.04.20, % or about
+%D title=\CONTEXT\ Style File,
+%D subtitle=Presentation Environment Phone,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+%D The theme of Bacho\TeX\ was \quote {Getting \TEX\ out of the closet}. And, as I'm
+%D always a bit sceptical about efforts to get a specialized toolbox like \TEX\
+%D accepted in a large scale generic user base, I decided to give a talk dedicated
+%D to Jerzy (the always optimistic organizer). (One can actually wonder if \TEX\ was
+%D ever hidden in a closet.) And, because I had to get the attention of some nephew
+%D and nieces I took there I gave the presentation without beamer but on my phone.
+%D On such a device one just swipes but I still added two buttons. Watch the small
+%D full|-|hd|-|ratio paper dimensions and 6 point font size.
+
+\startmodule[s-present-phone]
+
+\setupinteraction
+ [state=start]
+
+\definepapersize
+ [phone]
+ [width=108.0pt,
+ height=192.0pt]
+
+\definelayout
+ [phone]
+ [backspace=3pt,
+ topspace=6pt,
+ bottomspace=3pt,
+ header=0pt,
+ footer=0pt,
+ bottom=10pt,
+ bottomdistance=5pt,
+ height=fit,
+ width=middle]
+
+\setuplayout
+ [phone]
+
+\setuppapersize
+ [phone]
+
+\setupbodyfont
+ [dejavu,ss,6pt]
+
+\setupalign
+ [tolerant,flushleft]
+
+\setupbackgrounds
+ [page]
+ [background=color,
+ backgroundcolor=maincolor]
+
+\setupbackgrounds
+ [bottom]
+ [text]
+ [background=color,
+ backgroundcolor=othercolor,
+ backgroundoffset=\backspace]
+
+\definecolor[maincolor] [r=.7,g=.3,b=0]
+\definecolor[othercolor][r=0,g=.3,b=.7]
+
+\setupcolors
+ [textcolor=white]
+
+\setupinteraction
+ [menu=on,
+ color=white,
+ contrastcolor=white]
+
+\setupinteractionmenu
+ [bottom]
+ [state=start,
+ style=\ss\bf]
+
+\setupitemgroup
+ [itemize]
+ [inbetween={\blank[medium]}]
+
+\startinteractionmenu[bottom]
+ \startgot [previouspage] \textminus \stopgot
+ \starttxt \getmarking[section] \stoptxt
+ \startgot [nextpage] \textplus \stopgot
+\stopinteractionmenu
+
+\setuphead
+ [section]
+ [page=yes,
+ before=,
+ after={\blank[disable]},
+ placehead=empty]
+
+\stopmodule
+
+\continueifinputfile{s-present-phone.mkiv}
+
+\usemodule[present-common]
+
+\inputpresentationfile{bachotex/2016/bachotex-2016-toolbox.tex}
diff --git a/tex/context/modules/mkiv/s-present-punk.mkiv b/tex/context/modules/mkiv/s-present-punk.mkiv
new file mode 100644
index 000000000..346f7eae8
--- /dev/null
+++ b/tex/context/modules/mkiv/s-present-punk.mkiv
@@ -0,0 +1,158 @@
+%D \module
+%D [ file=s-present-punk,
+%D version=2008.04.15,
+%D title=\CONTEXT\ Style File,
+%D subtitle=Presentation Environment Punk,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+\startmodule[present-punk]
+
+%D At the cost of more runtime and a larger output file, we
+%D turn on randomization. The instances are cached in the
+%D MkIV cache, so successive runs use the same shapes.
+
+% \usemodule[punk] \usetypescript[punk] \setupbodyfont[punk,20pt]
+%
+% \EnableRandomPunk
+
+\setupbodyfont[punknova,20pt] % we now use the opentype variant
+
+%D We use the regular screen size paper and layout setup.
+
+\setuppapersize
+ [S6][S6]
+
+\setuplayout
+ [topspace=30pt,
+ backspace=30pt,
+ width=middle,
+ height=fit,
+ header=0pt,
+ footer=0pt,
+ bottomdistance=24pt,
+ bottom=30pt,
+ bottom=18pt,
+ top=0pt]
+
+\setupinterlinespace
+ [top=height,
+ line=1.25\bodyfontsize]
+
+\setupcolors
+ [state=start,
+ textcolor=white]
+
+\setupinteraction
+ [state=start,
+ %click=off,
+ menu=on]
+
+%D We predefine a few palets. Of course you can define more.
+
+\definecolor[punkblue] [r=.4,b=.8,g=.4]
+\definecolor[punkgreen] [r=.4,b=.4,g=.8]
+\definecolor[punkred] [r=.8,b=.4,g=.4]
+\definecolor[punkyellow][r=.6,g=.6,b=.2]
+
+\definepalet [punk-one] [textcolor=punkblue,pagecolor=punkgreen]
+\definepalet [punk-two] [textcolor=punkred,pagecolor=punkyellow]
+\definepalet [punk-three] [textcolor=punkblue,pagecolor=punkyellow]
+\definepalet [punk-one-reverse] [textcolor=punkgreen,pagecolor=punkblue]
+\definepalet [punk-two-reverse] [textcolor=punkyellow,pagecolor=punkred]
+\definepalet [punk-three-reverse] [textcolor=punkyellow,pagecolor=punkblue]
+
+\setuppalet[punk-one]
+
+%D We use a few backgrounds. The hyperlink that invokes the stepper is hooked
+%D into the text background.
+
+\definelayer
+ [page]
+ [width=\paperwidth,
+ height=\paperheight]
+
+\setupbackgrounds
+ [page]
+ [background={color,page},
+ backgroundcolor=pagecolor,
+ setups=pagestuff]
+
+\setupbackgrounds
+ [text]
+ [background={color,invoke},
+ backgroundoffset=12pt,
+ backgroundcolor=textcolor]
+
+%D We need different symbols for itemized lists.
+
+\definesymbol[1][\hbox{\lower1ex\hbox{*}}]
+\definesymbol[2][\endash]
+\definesymbol[3][\letterhash]
+\definesymbol[3][>]
+
+%D We don't want these reversed clicked areas in Acrobat.
+
+\setupinteraction
+ [click=no,
+ color=white, % pagecolor,
+ contrastcolor=white] % pagecolor,
+
+%D We define a rather simple navigational panel at the bottom
+
+\setupinteractionmenu
+ [bottom]
+ [color=white, % pagecolor,
+ contrastcolor=white, % pagecolor,
+ background=color,
+ backgroundcolor=textcolor,
+ frame=off,
+ height=24pt,
+ left=\hfill,
+ middle=\hskip12pt]
+
+\setupsubpagenumber
+ [state=start]
+
+\startinteractionmenu[bottom]
+ \starttxt
+ \interactionbar
+ [alternative=d,
+ symbol=yes,
+ color=white,
+ contrastcolor=textcolor]
+ \stoptxt
+ \hfilll
+ \startbut [previouspage] < < < \stopbut
+ \startbut [nextpage] > > > \stopbut
+\stopinteractionmenu
+
+%D Instead of the normal symbols we use more punky ones.
+
+\startsymbolset [punk]
+ \definesymbol[previous] [\string<\string<]
+ \definesymbol[somewhere] [\string^\string^]
+ \definesymbol[next] [\string>\string>]
+\stopsymbolset
+
+\setupinteraction
+ [symbolset=punk]
+
+%D Because the font is rather large, we use less whitespace.
+
+\setuphead
+ [chapter]
+ [after={\blank[big]}]
+
+\stopmodule
+
+\continueifinputfile{s-present-punk.mkiv}
+
+\usemodule[present-common]
+
+\inputpresentationfile{examples/present-punk-001.tex}
diff --git a/tex/context/modules/mkiv/s-present-random.lua b/tex/context/modules/mkiv/s-present-random.lua
new file mode 100644
index 000000000..f32d7aaea
--- /dev/null
+++ b/tex/context/modules/mkiv/s-present-random.lua
@@ -0,0 +1,66 @@
+if not modules then modules = { } end modules ['present-random'] = {
+ version = 1.001,
+ comment = "companion to s-present-random.mkiv",
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "see context related readme files"
+}
+
+-- For the moment we keep the namespace steps because it can become some
+-- shared module some day.
+
+moduledata.steps = moduledata.steps or { }
+local steps = moduledata.steps
+
+local locations = {
+ 'lefttop',
+ 'middletop',
+ 'righttop',
+ 'middleleft',
+ 'middle',
+ 'middleright',
+ 'leftbottom',
+ 'middlebottom',
+ 'rightbottom',
+}
+
+local done, current, previous, n
+
+function steps.reset_locations()
+ done, current, previous, n = table.tohash(locations,false), 0, 0, 0
+end
+
+function steps.next_location(loc)
+ previous = current
+ n = n + 1
+ loc = loc and loc ~= "" and tonumber(loc)
+ while true do
+ current = loc or math.random(1,#locations)
+ if not done[current] then
+ done[current] = true
+ break
+ end
+ end
+end
+
+function steps.current_location()
+ context(locations[current] or "")
+end
+
+function steps.previous_location()
+ context(locations[previous] or "")
+end
+
+function steps.current_n()
+ context(current)
+end
+
+function steps.previous_n()
+ context(previous)
+end
+
+function steps.step()
+ context(n)
+end
+
+steps.reset_locations()
diff --git a/tex/context/modules/mkiv/s-present-random.mkiv b/tex/context/modules/mkiv/s-present-random.mkiv
new file mode 100644
index 000000000..5744241fc
--- /dev/null
+++ b/tex/context/modules/mkiv/s-present-random.mkiv
@@ -0,0 +1,215 @@
+%D \module
+%D [ file=s-present-random,
+%D version=2008.08.05, % updated 2016.10.20
+%D title=\CONTEXT\ Style File,
+%D subtitle=Presentation Environment Random,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+\startmodule[present-random]
+
+%D Unfortunately there are not that many viewers that support javascript
+%D control over layers.
+
+% \enablemode[numbers]
+% \enablemode[paper]
+% \usemodule[present-stepwise]
+
+\registerctxluafile{s-present-random}{}
+
+\setupinteraction
+ [state=start,
+ click=off]
+
+\definepapersize
+ [wide]
+ [width=900pt,
+ height=600pt]
+
+\setuppapersize
+ [wide]
+ [wide]
+
+\setuplayout
+ [page]
+
+\setupsorting
+ [logo]
+ [style=]
+
+\startnotmode[paper]
+
+ \setupbackgrounds
+ [page]
+ [background=color,
+ backgroundcolor=black]
+
+\stopnotmode
+
+\definelayer
+ [page]
+ [width=\paperwidth,
+ height=\paperheight]
+
+\definecolor[TopicColor-1][r=.3,g=.4,b=.5]
+\definecolor[TopicColor-2][r=.3,g=.5,b=.4]
+\definecolor[TopicColor-3][r=.4,g=.3,b=.5]
+\definecolor[TopicColor-4][r=.4,g=.5,b=.3]
+\definecolor[TopicColor-5][r=.5,g=.3,b=.4]
+\definecolor[TopicColor-6][r=.5,g=.4,b=.3]
+\definecolor[TopicColor-7][r=.35,g=.35,b=.6]
+\definecolor[TopicColor-8][r=.6,g=.35,b=.35]
+\definecolor[TopicColor-9][r=.35,g=.6,b=.35]
+
+\definecolor[TopicColor-0][t=.5,a=1,s=.5]
+\definecolor[TopicColor] [s=1]
+
+\setupcolors
+ [textcolor=TopicColor]
+
+\starttexdefinition unexpanded StartTopics
+ \doifelsemode {paper} {
+ \disablemode[stepper]
+ \enablemode[onepagestepper]
+ } {
+ \doifelsedefined {NextStep} {
+ \enablemode[stepper]
+ \disablemode[onepagestepper]
+ } {
+ \disablemode[stepper]
+ \disablemode[onepagestepper]
+ }
+ }
+ \doifelsemode {onepagestepper} {
+ \startstandardmakeup[top=,bottom=\vfill]
+ } {
+ \setuplayer[state=repeat]
+ \resetlayer[page]
+ }
+ \ctxlua{moduledata.steps.reset_locations()}
+ \doifmode {interactivestepper} {
+ \StartLocalSteps
+ }
+\stoptexdefinition
+
+\starttexdefinition unexpanded StopTopics
+ \doifmode {interactivestepper} {
+ \StopLocalSteps
+ }
+ \doifelsemode {onepagestepper} {
+ \flushlayer[page]
+ \stopstandardmakeup
+ } {
+ \resetlayer[page]
+ }
+\stoptexdefinition
+
+\starttexdefinition unexpanded StartTopic
+ \dosingleempty\doStartTopic
+\stoptexdefinition
+
+\starttexdefinition unexpanded doStartTopic [#1]
+ \doifmode {interactivestepper} {
+ \NextStep
+ }
+ \ctxlua{moduledata.steps.next_location("#1")}
+ \doifmode {paper} {
+ \doifnothing {#1} {
+ \ifcase\ctxlua{moduledata.steps.previous_n()}\else
+ \setlayer
+ [page]
+ [preset=\ctxlua{moduledata.steps.previous_location()}]
+ \bgroup
+ \doifmode {interactivestepper} {
+ \startviewerlayer[\StepLayer]
+ }
+ \framed
+ [offset=20pt,
+ strut=no,
+ align=normal,
+ frame=off,
+ height=\dimexpr\paperheight/3\relax,
+ width=\dimexpr\paperwidth/3\relax,
+ background=color,
+ backgroundcolor=TopicColor-0]
+ {}
+ \doifmode {interactivestepper} {
+ \stopviewerlayer
+ }
+ \egroup
+ \fi
+ }
+ }
+ \setlayer
+ [page]
+ [preset=\ctxlua{moduledata.steps.current_location()}]
+ \bgroup
+ \doifmode {interactivestepper} {
+ \startviewerlayer[\StepLayer]
+ }
+ \framed
+ [offset=20pt,
+ strut=no,
+ align=\expdoifelse{#1}{}{normal}{middle,lohi},
+ align=\expdoifelse{#1}{}{flushleft,verytolerant}{middle,lohi},
+ frame=off,
+ height=\dimexpr\paperheight/3\relax,
+ width=\dimexpr\paperwidth/3\relax,
+ background=color,
+ backgroundcolor=TopicColor-\ctxlua{moduledata.steps.current_n()}]
+ \bgroup
+ \ignorespaces
+\stoptexdefinition
+
+\starttexdefinition unexpanded StopTopic
+ \removeunwantedspaces
+ \egroup
+ \doifmode {interactivestepper} {
+ \stopviewerlayer
+ }
+ \egroup
+ \doifmode {numbers} {
+ \setlayerframed
+ [page]
+ [preset=\ctxlua{moduledata.steps.current_location()}]
+ [height=\dimexpr\paperheight/3\relax,
+ width=\dimexpr\paperwidth/3\relax,
+ frame=off,
+ foregroundstyle=\bfa,
+ align={flushright,low}]
+ \bgroup
+ \doifmode {interactivestepper} {
+ \startviewerlayer[\StepLayer]
+ }
+ \ctxlua{moduledata.steps.step()}\kern\strutdepth
+ \doifmode {interactivestepper} {
+ \stopviewerlayer
+ }
+ \egroup
+ }
+ \doifnotmode {onepagestepper} {
+ \startstandardmakeup[top=,bottom=\vfill]
+ \flushlayer[page]
+ \stopstandardmakeup
+ }
+\stoptexdefinition
+
+\definefont[TitleFont][SansBold*default at 60pt]
+\definefont[TempFont] [SansBold*default at 12pt]
+
+\let\StartText\starttext % for old times sake
+\let\StopText \stoptext % for old times sake
+
+\stopmodule
+
+\continueifinputfile{s-present-random.mkiv}
+
+\usemodule[present-common]
+
+\inputpresentationfile{examples/present-random-001.tex}
+
diff --git a/tex/context/modules/mkiv/s-present-shaded.mkiv b/tex/context/modules/mkiv/s-present-shaded.mkiv
new file mode 100644
index 000000000..df6ab9c5c
--- /dev/null
+++ b/tex/context/modules/mkiv/s-present-shaded.mkiv
@@ -0,0 +1,161 @@
+%D \module
+%D [ file=s-present-shaded,
+%D version=2014.04.30,
+%D title=\CONTEXT\ Style File,
+%D subtitle=Presentation Environment Shaded Content,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+%D As usual, this style was made for a Bacho\TeX\ conference. It doesn't do anything
+%D special apart from progressively changing the shaded backgrounds. You can
+%D redefine the colors \type {maincolor} and \type {othercolor} to suit your taste.
+
+\startmodule[present-shaded]
+
+\setuppapersize[S6]
+
+\setuplayout
+ [cutspace=120pt,
+ rightmargin=100pt,
+ margindistance=10pt,
+ rightmargin=0pt,
+ margindistance=0pt,
+ rightedge=100pt,
+ edgedistance=12.5pt,
+ backspace=10pt,
+ topspace=10pt,
+ bottomspace=10pt,
+ header=0pt,
+ footer=0pt,
+ width=middle,
+ height=middle]
+
+\setupbodyfont
+ [dejavu]
+
+\setuplist
+ [chapter]
+ [before=,
+ after=,
+ inbetween=\vskip5pt,
+ inbetween=\vfill,
+ alternative=e,
+ width=\hsize,
+ height=\measure{menu-item-height},
+ style=bold,
+ frame=off,
+ background=color,
+ backgroundcolor=\structurelistuservariable{color},
+ criterium=text]
+
+\setupcolors
+ [textcolor=white]
+
+\setupinteraction
+ [state=start,
+ menu=on,
+ color=white,
+ click=off,
+ contrastcolor=white]
+
+\setupinteractionmenu
+ [right]
+ [topoffset=5pt,
+ bottomoffset=5pt]
+
+\startinteractionmenu[right]
+ \placelist[chapter]
+\stopinteractionmenu
+
+\definecolor[maincolor] [b=.4]
+\definecolor[othercolor][s=.4]
+
+\definecolor[verydark][s=.2]
+\definecolor[lessdark][1.5(verydark)]
+
+% we need some extra counter values: \getstructurenumber{self}
+
+\setupmodule
+ [n=\the\numexpr\lastpage-\plusone\relax]
+
+\appendtoks
+ \dorecurse {\moduleparameter{present-shaded}{n}} {
+ \definecolor[shade:#1][\luaexpr{.8*#1/\moduleparameter{present-shaded}{n}}(maincolor,othercolor)]
+ }
+\to \everystarttext
+
+\setupbackgrounds
+ [page]
+ [background=color,
+ backgroundoffset=5pt,
+ backgroundcolor=verydark]
+
+\setupbackgrounds
+ [text]
+ [background={invoke,color},
+ backgroundoffset=5pt,
+ backgroundcolor=\namedstructureuservariable{chapter}{color}]
+
+\definemeasure
+ [menu-item-height]
+ [(\textheight-\numexpr\moduleparameter{present-shaded}{n}-1\relax\dimexpr5pt\relax)/\moduleparameter{present-shaded}{n}]
+
+\setupitemgroup
+ [itemize]
+ [packed]
+
+\setuphead
+ [chapter]
+ [number=no,
+ style=\bfc]
+
+\setuphead
+ [section]
+ [number=no,
+ style=\bf,
+ before=\blank,
+ after=\blank]
+
+\setupdocument
+ [title=Title,
+ subtitle=Subtitle,
+ location=\currentdate]
+
+\startsetups document:start
+
+ \setupbackgrounds
+ [text]
+ [backgroundcolor=lessdark]
+
+ \startstandardmakeup
+
+ \setupalign[middle]
+
+ \vfil
+ \dontleavehmode \scale[width=.8\textwidth] {\documentvariable{title}}
+ \vfil
+ \dontleavehmode \scale[width=.6\textwidth] {\documentvariable{subtitle}}
+ \vfil \vfil \vfil
+ \dontleavehmode \scale[width=.4\textwidth] {\documentvariable{location}}
+ \vfil
+
+ \stopstandardmakeup
+
+ \setupbackgrounds
+ [text]
+ [backgroundcolor=\namedstructureuservariable{chapter}{color}]
+
+\stopsetups
+
+\stopmodule
+
+\continueifinputfile{s-present-shaded.mkiv}
+
+\usemodule[present-common]
+
+\inputpresentationfile{examples/present-shaded-001.tex}
diff --git a/tex/context/modules/mkiv/s-present-simple.mkiv b/tex/context/modules/mkiv/s-present-simple.mkiv
new file mode 100644
index 000000000..4fadf1f9f
--- /dev/null
+++ b/tex/context/modules/mkiv/s-present-simple.mkiv
@@ -0,0 +1,151 @@
+%D \module
+%D [ file=s-present-simple, % was: s-pre-68,
+%D version=2009.08.28,
+%D title=\CONTEXT\ Style File,
+%D subtitle=Presentation Environment Simple,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+\usemodule[present-stepwise]
+
+\startmodule[present-simple]
+
+% style
+
+\setuppapersize
+ [S66][S66]
+
+\setuplayout
+ [height=middle,
+ width=middle,
+ header=0pt,
+ footer=0pt,
+ backspace=2cm,
+ topspace=2cm]
+
+\setupinteraction
+ [state=start,
+ click=no]
+
+\definecolor[maincolor][r=.4]
+
+\startreusableMPgraphic{page}
+ StartPage ;
+ fill Page enlarged 5mm withcolor "maincolor" ;
+ StopPage ;
+\stopreusableMPgraphic
+
+\startreusableMPgraphic{next}
+ fill ultriangle scaled .15PaperWidth withcolor white ;
+\stopreusableMPgraphic
+
+\startreusableMPgraphic{last}
+ fill boundingbox(ultriangle scaled .15PaperWidth) withcolor white ;
+\stopreusableMPgraphic
+
+\startuniqueMPgraphic{bullit}
+ fill ultriangle scaled 2ExHeight withcolor white ;
+\stopuniqueMPgraphic
+
+\definelayer
+ [extra]
+ [width=\paperwidth,
+ height=\paperheight]
+
+\defineoverlay
+ [page]
+ [\reuseMPgraphic{page}]
+
+\setupbackgrounds
+ [page]
+ [background={page,extra}]
+
+\setupcolors
+ [state=start,
+ textcolor=white]
+
+\setuphead
+ [chapter]
+ [style=\bfc]
+
+\definehead
+ [Title]
+ [title]
+
+\definesymbol
+ [MyBullet]
+ [\uniqueMPgraphic{bullit}]
+
+\setupitemgroup
+ [itemize]
+ [each]
+ [symbol=MyBullet]
+
+\doifelsemode {asintended,atpragma} {
+ \setupbodyfont[cambria,14.4pt]
+} {
+ \setupbodyfont[pagella,14.4pt]
+}
+
+% interface
+
+\unexpanded\def\StartItems
+ {\begingroup
+ \StartSteps
+ \startitemize
+ \unexpanded\def\StartItems{\startitemize\unexpanded\def\StopItems{\stopitemize}}}
+
+\unexpanded\def\StopItems
+ {\FlushStep
+ \stopitemize
+ \NextPageSymbol
+ \StopSteps
+ \endgroup}
+
+\unexpanded\def\Item
+ {\unexpanded\def\Item{\FlushStep\item}
+ \item}
+
+\unexpanded\def\NextPageSymbol
+ {\setlayer
+ [extra]
+ [preset=rightbottom,offset=2mm]
+ {\ifnum\realpageno=\lastpage\relax
+ \reuseMPgraphic{last}%
+ \else\ifnum\realpageno>\plusone
+ \reuseMPgraphic{next}%
+ \fi\fi
+ \FlushStep}}
+
+\unexpanded\def\TitlePage#1#2%
+ {\startstandardmakeup[bottom=,top=]
+ \scale[width=\textwidth]{\framed[align=flushleft,foregroundstyle=\bf,frame=off]{#1}}
+ \vfilll
+ \hfill\scale[width=.5\textwidth]{\framed[align=flushright,foregroundstyle=\bf,frame=off]{#2}}
+ \stopstandardmakeup}
+
+\unexpanded\def\StartTopic#1%
+ {\Title{#1}}
+
+\unexpanded\def\StopTopic
+ {\page}
+
+\startsetups document:start
+ \TitlePage
+ {\documentvariable{title}}
+ {\documentvariable{author}\\
+ \documentvariable{location}}
+\stopsetups
+
+\stopmodule
+
+\continueifinputfile{s-present-simple.mkiv}
+
+\usemodule[present-common]
+
+\inputpresentationfile{examples/present-simple-001.tex}
diff --git a/tex/context/modules/mkiv/s-present-slanted.mkiv b/tex/context/modules/mkiv/s-present-slanted.mkiv
new file mode 100644
index 000000000..a68e0cd8e
--- /dev/null
+++ b/tex/context/modules/mkiv/s-present-slanted.mkiv
@@ -0,0 +1,206 @@
+%D \module
+%D [ file=s-present-slanted, % was: s-pre-64,
+%D version=2006.05.11,
+%D title=\CONTEXT\ Style File,
+%D subtitle=Presentation Environment Slanted,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+%D This style is kept as reference (but can be usedof course). It was used at the
+%D TUG conference in San Diego in 2007 (the very early days if \LUATEX\ and \MKIV).
+%D
+%D This was one of he four presentations, each with a different style. The other
+%D styles were quite ok but I just lack time (ane motivation) to generalize them,
+
+\usemodule[s][pre-60]
+
+\newcounter\shapesynctag
+\newdimen \slantedshapedimen
+\newdimen \slantedshapestep
+\newdimen \slantedshapeleftskip
+\newdimen \slantedshapeoffset
+\newdimen \slantedshapeextra
+\newdimen \slantedshapedelta
+
+\positioningtrue
+
+\unexpanded\def\AdaptShape
+ {\doglobal\increment\shapesynctag
+ \getnoflines\textheight
+ \slantedshapestep\dimexpr\slantedshapeleftskip/\noflines\relax
+ \leftskip\slantedshapeleftskip
+ \scratchdimen\dimexpr
+ \MPy{text:\MPp\shapesynctag}
+ +\MPh{text:\MPp\shapesynctag}
+ -\topskip
+ -\MPy\shapesynctag
+ +\slantedshapeextra
+ \relax
+ \getnoflines\scratchdimen
+ \slantedshapedimen \noflines \slantedshapestep
+ \scratchtoks\emptytoks
+ \dorecurse{30}
+ {\appendetoks
+ \the\dimexpr
+ -\slantedshapedimen
+ +\slantedshapeoffset
+ +\slantedshapedelta
+ \relax
+ \space
+ \the\dimexpr
+ \hsize
+ -2\slantedshapeoffset
+ \relax
+ \space
+ \to\scratchtoks
+ \advance\slantedshapedimen \slantedshapestep}%
+ \parshape 30 \the\scratchtoks
+ \strut\xypos\shapesynctag}
+
+\setuppapersize[S6][S6]
+
+\setupinteraction
+ [state=start,
+ click=no]
+
+\setupinteractionscreen
+ [option=max]
+
+\setuplayout
+ [backspace=12pt,
+ topspace=24pt,
+ height=middle,
+ width=middle,
+ header=0pt,
+ footer=0pt]
+
+\definecolor[maincolor][b=.5]
+\definecolor[somecolor][g=.5]
+\definecolor[morecolor][r=.5]
+
+\setupcolors
+ [textcolor=maincolor]
+
+\setupbodyfont
+ [pagella]
+
+\setupbackgrounds
+ [text]% [text]
+ [background={base,text,invoke}]
+
+\definelayer
+ [text]
+ [width=\textwidth,
+ height=\textheight]
+
+\definelayer
+ [base]
+ [width=\textwidth,
+ height=\textheight]
+
+\definetype [epet] [style=,color=morecolor]
+\setuptype [style=,color=somecolor]
+\slantedshapeleftskip150pt
+\slantedshapeoffset 12pt
+\slantedshapeextra 10pt
+
+\startreusableMPgraphic{page}
+ StartPage ;
+ fill Page withcolor \MPcolor{maincolor} ;
+ path p ; p := Field[Text][Text] enlarged 6pt ;
+ p :=
+ llcorner p shifted (0,-12pt) --
+ lrcorner p shifted (-150pt,0) --
+ urcorner p shifted (0,12pt) --
+ ulcorner p shifted (150pt,0) --
+ cycle ;
+ fill p
+ withcolor .9white ;
+ StopPage ;
+\stopreusableMPgraphic
+
+\defineoverlay
+ [page]
+ [\reuseMPgraphic{page}]
+
+\setupbackgrounds
+ [page]
+ [background=page]
+
+\setupalign
+ [flushleft]
+
+\unexpanded\def\StartItem
+ {\blank[line]
+ \begingroup
+ \EveryPar {\AdaptShape}} % beware: \ABBREV aan begin gaat fout
+
+\unexpanded\def\StopItem
+ {\endgraf
+ \endgroup
+ \blank[line]}
+
+\unexpanded\def\StartType
+ {\blank[halfline]
+ \begingroup
+ \EveryPar {\AdaptShape}
+ \dontleavehmode \quad}
+
+\unexpanded\def\StopType
+ {\endgraf
+ \endgroup
+ \blank[halfline]}
+
+\unexpanded\def\StartTopic#1%
+ {\page
+ \setlayer
+ [text]
+ [preset=lefttop,
+ rotation=90]
+ {\color[white]{\scale[height=24pt]{\strut#1}}}}
+
+\unexpanded\def\StopTopic
+ {\page}
+
+\startsetups document:start
+ \ifdefined\TitleFont \else
+ \definedfont[TitleFont][Bold*default sa 4]
+ \fi
+ \ifdefined\MainTextFont
+ \MainTextFont
+ \fi
+ \Banner{\documentvariable{location}}
+ \StartTopic{\documentvariable{author}}
+ \startstandardmakeup
+ \TitleFont
+ \setupinterlinespace[line=3ex]
+ \vfill
+ \def\docommand##1{\StartItem\dontleavehmode\quad{\morecolor##1}\StopItem}
+ \processcommacommand[\documentvariable{title}]\docommand
+ \vfill
+ \stopstandardmakeup
+ \StopTopic
+\stopsetups
+
+\startsetups document:stop
+\stopsetups
+
+\unexpanded\def\Banner#1%
+ {\setuplayer
+ [base]
+ [state=repeat]
+ \setlayer
+ [base]
+ [preset=rightbottom]
+ {\color[white]{\scale[height=9pt]{\strut#1}}}}
+
+\continueifinputfile{s-present-slanted.mkiv}
+
+\usemodule[present-common]
+
+\inputpresentationfile{tug/2007/tug-2007-fonts.tex}
diff --git a/tex/context/modules/mkiv/s-present-split.mkiv b/tex/context/modules/mkiv/s-present-split.mkiv
new file mode 100644
index 000000000..48be7ca81
--- /dev/null
+++ b/tex/context/modules/mkiv/s-present-split.mkiv
@@ -0,0 +1,191 @@
+%D \module
+%D [ file=s-present-split, % s-pre-14,
+%D version=1999.08.20,
+%D title=\CONTEXT\ Style File,
+%D subtitle=Presentation Environment Split,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+%D In the process of making a couple of simple styles for \EUROTEX\ 99, I came to
+%D this one. The joke is in the pagenumber. This style can be used for short
+%D presentations with much text.
+
+\startmodule[present-split]
+
+\startmode[asintended,atpragma] \setupbodyfont[lucidaot] \stopmode
+
+\setupbodyfont[14.4pt]
+
+%D Since we expect text, we can best be very tolerant.
+
+\setuptolerance
+ [verytolerant,stretch]
+
+%D As most styles we choose a large screen page size.
+
+\setuppapersize
+ [S6][S6]
+
+\setuplayout
+ [width=fit,
+ rightedge=3cm,
+ margin=0pt,
+ rightedgedistance=2cm,
+ height=middle,
+ header=0pt,
+ footer=0pt,
+ topspace=1cm,
+ backspace=1cm]
+
+%D We only use two colors, named \type {ColorOne} and \type {ColorTwo}:
+
+\definecolor [ColorOne] [r=.6,g=.4,b=.4]
+\definecolor [ColorTwo] [r=.4,g=.6,b=.6]
+
+%D If you've looked at the demo file, you will have noticed that the background
+%D consists of four pieces: two filled rectangles and two half numbers. In older
+%D versions these are put on the page using four overlays, here we use a much
+%D cleaner implementation is the following. If you hate \METAPOST, you can run
+%D this style in the specified mode:
+
+\setupbackgrounds
+ [page]
+ [background={number}]
+
+\defineoverlay[number][\useMPgraphic{number}]
+
+\startuseMPgraphic{number}
+ StartPage ;
+ picture Left, Right ;
+ numeric Shift ; Shift := -TextWidth - BackSpace - RightEdgeDistance/2 ;
+ fill Page withcolor "ColorOne" ;
+ fill Page leftenlarged Shift withcolor "ColorTwo" ;
+ if RealPageNumber > 1 :
+ Left := Right := textext("\bf\folio") ysized 3cm ;
+ clip Right to boundingbox Right shifted ( bbwidth(Right)/2,0) ;
+ clip Left to boundingbox Left shifted (-bbwidth(Left) /2,0) ;
+ draw Left shifted (-Shift,2.25cm) withcolor "ColorTwo" ;
+ draw Right shifted (-Shift,2.25cm) withcolor "ColorOne" ;
+ fi ;
+ StopPage ;
+\stopuseMPgraphic
+
+%D We use the simple label typesetting present in \METAPOST\ because digits are
+%D seldom kerned so real \TEX ing is not needed. As in the previous method, we let
+%D the graphics overlap so that we don't get white lines due to rounding problems in
+%D viewers.
+%D
+%D We put a button behind the text (this overlay is calculated each page).
+
+\defineoverlay
+ [nextpage]
+ [\overlaybutton{nextpage}]
+
+\setupbackgrounds
+ [text]
+ [backgroundoffset=.5cm,
+ background=nextpage]
+
+%D We still have to turn on interaction mode.
+
+\setupinteraction
+ [state=start,
+ display=new,
+ menu=on]
+
+\setupinteraction
+ [color=,
+ contrastcolor=]
+
+%D Next we define structuring commands.
+
+\definehead[Topic] [chapter] \setuphead[Topic] [style=\bfc]
+\definehead[Subject][section] \setuphead[Subject][style=\bfa]
+
+\setuphead
+ [Topic,Subject]
+ [number=no,
+ after={\blank[big]}]
+
+%D Because we will provide a menu, we don't offer lists.
+
+\let\Topics \gobbleoneargument
+\let\Subjects\relax
+
+%D The table of contents goes to the right edge.
+
+\startinteractionmenu[right]
+ \setupinteraction
+ [color=black,
+ contrastcolor=Two]
+ \placelist
+ [Topic]
+ [alternative=e,
+ frame=off,
+ criterium=all]
+ \vfill
+\stopinteractionmenu
+
+\setuplist
+ [Topic]
+ [width=\rightedgewidth,
+ maxwidth=\rightedgewidth,
+ style=\bfa]
+
+%D We safe some space:
+
+\setupwhitespace
+ [medium]
+
+\setupblank
+ [medium]
+
+%D In the titlepage, we still use the \TEX\ overlays, so that we don't have to
+%D define a second graphic.
+
+\unexpanded\def\TitlePage#1%
+ {\StartTitlePage#1\StopTitlePage}
+
+\unexpanded\def\StartTitlePage
+ {\startstandardmakeup
+ \setupalign[middle]
+ \unexpanded\def\\{\vfil\bfb\setupinterlinespace}
+ \bfd\setupinterlinespace
+ \vfil}
+
+\unexpanded\def\StopTitlePage
+ {\vfil\vfil\vfil
+ \stopstandardmakeup}
+
+\startsetups document:start
+ \StartTitlePage
+ \documentvariable{title}
+ \doifsomething {\documentvariable{subtitle}} {
+ \\
+ \documentvariable{subtitle}
+ }
+ \doifsomething {\documentvariable{location}} {
+ \\
+ \documentvariable{location}
+ }
+ \StopTitlePage
+\stopsetups
+
+\startsetups document:stop
+ %
+\stopsetups
+
+\stopmodule
+
+%D This is it.
+
+\continueifinputfile{s-present-split.mkiv}
+
+\usemodule[present-common]
+
+\inputpresentationfile{examples/present-split-001.tex}
diff --git a/tex/context/modules/mkiv/s-present-stack.mkiv b/tex/context/modules/mkiv/s-present-stack.mkiv
new file mode 100644
index 000000000..4cc75404f
--- /dev/null
+++ b/tex/context/modules/mkiv/s-present-stack.mkiv
@@ -0,0 +1,194 @@
+%D \module
+%D [ file=s-present-stack, % was s-pre-11
+%D version=1999.08.20,
+%D title=\CONTEXT\ Style File,
+%D subtitle=Presentation Environment Stack,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+\startmodule[present-stack]
+
+%D This is ancient but shows a few tricks so we keep it around in \MKIV\
+%D anyway.
+
+\setuppapersize
+ [S6][S6]
+
+\setuplayout
+ [topspace=0cm,
+ backspace=0cm,
+ header=0pt,
+ footer=0pt,
+ width=middle,
+ height=middle]
+
+\doifelsemode {asintended} {
+ \setupbodyfont[ludicaot,14.4pt]
+} {
+ \setupbodyfont[pagella,14.4pt]
+}
+
+\setupinteraction
+ [click=no,
+ display=new,
+ state=start]
+
+\setupinteractionscreen
+ [option=max]
+
+\unexpanded\def\SomeShape
+ {\resetMPdrawing
+ \startMPdrawing
+ path p[], q[] ; pair a, b ;
+ StartPage ;
+ \stopMPdrawing
+ \dorecurse{\CurrentTopic}
+ {\startMPdrawing
+ initialize_box(\MPpos{topic-\realfolio-\recurselevel}) ;
+ p[\recurselevel] := tensecircle (wxy,hxy,.25cm) shifted cxy ;
+ fill p[\recurselevel] withcolor .9white ;
+ pickup pencircle scaled .25cm ;
+ if \recurselevel = \CurrentTopic :
+ draw p[\recurselevel] withcolor \MPcolor{ShowColor} ;
+ else :
+ draw p[\recurselevel] withcolor \MPcolor{DoneColor} ;
+ fi ;
+ \stopMPdrawing}%
+ \dorecurse{\CurrentMaxItem}
+ {\startMPdrawing
+ initialize_box(\MPpos{item-\realfolio-\recurselevel}) ;
+ linewidth := .25cm ;
+ q[\recurselevel] := tensecircle (wxy,hxy,linewidth) shifted cxy ;
+ fill q[\recurselevel] withcolor .9white ;
+ pickup pencircle scaled linewidth ;
+ if \recurselevel = \CurrentMaxItem :
+ draw q[\recurselevel] withcolor \MPcolor{ShowColor} ;
+ else :
+ draw q[\recurselevel] withcolor \MPcolor{DoneColor} ;
+ fi ;
+ \stopMPdrawing}%
+ \dostepwiserecurse{2}{\CurrentTopic}{1}
+ {\startMPdrawing
+ draw
+ rt point 3 of p[\recurselevel-1] --
+ lft point 7 of p[\recurselevel]
+ withcolor \MPcolor{ArrowColor} ;
+ \stopMPdrawing}%
+ \dostepwiserecurse{2}{\CurrentMaxItem}{1}
+ {\startMPdrawing
+ draw
+ bot point 9 of q[\recurselevel-1] --
+ top point 5 of q[\recurselevel]
+ withcolor \MPcolor{ArrowColor} ;
+ \stopMPdrawing}%
+ \startMPdrawing
+ draw Page
+ withpen pencircle scaled .5cm
+ withcolor \MPcolor{EdgeColor} ;
+ StopPage ;
+ \stopMPdrawing
+ \MPdrawingdonetrue
+ \getMPdrawing}
+
+\unexpanded\def\TitlePage#1%
+ {\startstandardmakeup
+ \setupalign[middle]
+ \def\\{\vfil\bfb\setupinterlinespace}
+ \bfd\setupinterlinespace
+ \vfil#1\vfil\vfil
+ \stopstandardmakeup}
+
+\definecolor[PageColor][r=.5,g=.4,b=.3]
+\definecolor[LineColor][r=.7,g=.6,b=.5]
+
+\definecolor[PageColor] [s=.60]
+\definecolor[ShowColor] [r=.40]
+\definecolor[EdgeColor] [g=.40]
+\definecolor[DoneColor] [r=.40,g=.40]
+\definecolor[ArrowColor] [b=.40]
+\definecolor[LineColor] [r=.60,g=.60]
+\definecolor[GotoColor] [ArrowColor]
+
+\setupinteraction
+ [color=GotoColor,
+ contrastcolor=GotoColor]
+
+\defineoverlay [shape] [\SomeShape]
+\defineoverlay [next] [\overlaybutton{forward}] % [{nextpage}]
+
+\setupbackgrounds
+ [page]
+ [background={color,next,shape},
+ backgroundcolor=PageColor]
+
+\doglobal\newcounter\CurrentMaxItem
+\doglobal\newcounter\CurrentItem
+\doglobal\newcounter\CurrentTopic
+
+\unexpanded\def\StartIdea
+ {\doglobal\newcounter\CurrentItem}
+
+\unexpanded\def\StartTopic
+ {\doglobal\increment\CurrentTopic
+ \dostartbuffer[topic-\CurrentTopic][StartTopic][StopTopic]}
+
+\unexpanded\def\StopIdea
+ {\dorecurse{\CurrentItem}
+ {\let\CurrentMaxItem\recurselevel
+ \doStopIdea}}
+
+\unexpanded\def\doStopIdea
+ {\startstandardmakeup
+ \dontcomplain
+ \vskip.875cm
+ \hbox to \makeupwidth
+ {\hfill
+ \dorecurse{\CurrentTopic}
+ {\edef\Topic{topic-\realfolio-\recurselevel}%
+ \hpos
+ {\Topic}
+ {\framed
+ [frame=off,align=middle,offset=.25cm]
+ {\getbuffer[topic-\recurselevel]}}%
+ \ifnum\recurselevel<\CurrentTopic
+ \hskip.875cm
+ \fi}%
+ \hfill}
+ \vskip.875cm
+ \vfilll
+ \dorecurse{\CurrentMaxItem}
+ {\edef\Item{item-\realfolio-\recurselevel}
+ \hbox to \makeupwidth
+ {\hfill
+ \hpos
+ {\Item}
+ {\framed
+ [width=.75\makeupwidth,
+ frame=off,
+ align=middle,offset=.125cm]
+ {\getbuffer[item-\recurselevel]}}%
+ \hfill}
+ \vskip.875cm}
+ \vfilll
+ \stopstandardmakeup}
+
+\unexpanded\def\StartItem
+ {\doglobal\increment\CurrentItem
+ \dostartbuffer[item-\CurrentItem][StartItem][StopItem]}
+
+\setupalign
+ [nothyphenated]
+
+\stopmodule
+
+\continueifinputfile{s-present-stack.mkiv}
+
+\usemodule[present-common]
+
+\inputpresentationfile{examples/present-stack-001.tex}
+
diff --git a/tex/context/modules/mkiv/s-present-stepper.mkiv b/tex/context/modules/mkiv/s-present-stepper.mkiv
new file mode 100644
index 000000000..3dd8d9dcd
--- /dev/null
+++ b/tex/context/modules/mkiv/s-present-stepper.mkiv
@@ -0,0 +1,227 @@
+%D \module
+%D [ file=s-present-stepper, % was s-pre-61
+%D version=2004.03.15,
+%D title=\CONTEXT\ Style File,
+%D subtitle=Presentation Environment Stepper,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+%D Optima
+
+\startmodule[present-stepper]
+
+\usemodule[pre-60]
+
+\doifmodeelse {atpragma,asintended} {
+ \usetypescriptfile[ghz]
+ \definetypeface[mainface][ss][sans][optima-nova][default]
+} {
+ \usetypescriptfile[type-ghz]
+ \definetypeface[mainface][ss][sans][optima-nova][default][encoding=\defaultencoding]
+}
+
+\setupbodyfont[mainface,ss,18pt]
+
+\setupinterlinespace
+ [line=3.25ex]
+
+\setuppapersize
+ [S6][S6]
+
+% \setuppapersize
+% [SW][SW]
+
+\setuplayout
+ [topspace=10pt,
+ header=30pt,
+ headerdistance=20pt,
+ height=middle,
+ footerdistance=20pt,
+ footer=0pt,
+ bottomdistance=20pt,
+ bottom=20pt,
+ bottomspace=50pt,
+ backspace=30pt,
+ width=middle]
+
+\setupinteraction
+ [state=start,
+ click=off,
+ menu=on,
+ style=,
+ color=interactioncolor,
+ contrastcolor=interactioncolor]
+
+\setupinteractionscreen
+ [option=max]
+
+\setupinteractionmenu
+ [bottom]
+ [color=maincolor,
+ contrastcolor=maincolor,
+ style=\tfa, % acceptable
+ left=\hfill,
+ middle=,
+ right=,
+ height=\bottomheight,
+ width=2\bottomheight,
+ offset=overlay,
+ frame=off]
+
+\startinteractionmenu[bottom]
+ \but [firstpage] \symbol[firstpage] \\
+ \but [previouspage] \symbol[previouspage] \\
+ \but [InvokeStepper] \StartBusy\symbol[PauseRendering]\StopBusy \\
+ \but [nextpage] \symbol[nextpage] \\
+ \but [lastpage] \symbol[lastpage] \\
+ \but [CloseDocument] \symbol[CloseDocument] \\
+\stopinteractionmenu
+
+% maybe in colo-sjk : \setupcolor[sjk]
+
+\definecolor [dark] [s=.4]
+\definecolor [bright] [s=.9]
+
+\definecolor [red] [r=.4,g=.2,b=.2]
+\definecolor [green] [r=.2,g=.4,b=.2]
+\definecolor [blue] [r=.2,g=.2,b=.4]
+
+\definecolor [cyan] [r=.2,g=.4,b=.4]
+\definecolor [magenta] [r=.4,g=.2,b=.4]
+\definecolor [yellow] [r=.4,g=.4,b=.2]
+
+\definecolor [pagecolor] [dark]
+\definecolor [maincolor] [bright]
+\definecolor [textcolor] [red]
+
+\definecolor [interactioncolor] [r=.8,g=.8,b=.6]
+
+\setupcolors
+ [textcolor=maincolor]
+
+\setupbackgrounds
+ [page]
+ [background=page,
+ backgroundcolor=textcolor]
+
+\setupbackgrounds
+ [text]% [text]
+ [background={comments,text,invoke}]
+
+\definelayer
+ [text]
+ [width=\textwidth,
+ height=\textheight]
+
+\defineoverlay
+ [comments]
+ [{\setlayer[text][preset=middle]{\placecomments}}]
+
+\defineoverlay[page][\uniqueMPgraphic{page-\ifcase\realpageno\or one\else plus\fi}]
+
+\startuniqueMPgraphic{page-one}
+ StartPage ;
+ fill Page
+ enlarged 4pt
+ withcolor \MPcolor{pagecolor} ;
+ fill Field[Text][Text]
+ enlarged 10pt
+ % topenlarged (HeaderHeight+HeaderDistance)
+ leftenlarged (BackSpace+4pt)
+ rightenlarged (CutSpace +4pt)
+ withcolor OverlayColor ;
+ StopPage ;
+\stopuniqueMPgraphic
+
+\startuniqueMPgraphic{page-plus}
+ StartPage ;
+ fill Page
+ enlarged 4pt
+ withcolor \MPcolor{pagecolor} ;
+ fill Field[Text][Text]
+ enlarged 10pt
+ leftenlarged (BackSpace+4pt)
+ rightenlarged (CutSpace+4pt)
+ withcolor OverlayColor ;
+ StopPage ;
+\stopuniqueMPgraphic
+
+\startsetups fonts:normalize
+ \definefont[HeadFont] [SansBold*default ht \the\dimexpr0.750\headerheight\relax]
+ \definefont[TitleFont] [SansBold*default ht \the\dimexpr1.500\headerheight\relax]
+ \definefont[SubTitleFont] [SansBold*default ht \the\dimexpr0.375\headerheight\relax]
+ \definefont[SubSubTitleFont] [SansBold*default ht \the\dimexpr0.750\headerheight\relax]
+\stopsetups
+
+\setuphead
+ [chapter]
+ [placehead=empty,
+ after={\blank[medium]},
+ color=maincolor,
+ placenumber=no,
+ style=\HeadFont]
+
+\setupheadertexts
+ [\doiftextelse{\currentheadnumber}{\placeheadtext[Topic]}{\placeheadtext[Nopic]}]
+ []
+
+\setuppagenumbering
+ [location=]
+
+\definesymbol
+ [emdash]
+ [\emdash]
+
+\setupitemize
+ [each]
+ [loose,serried,joinedup,broad]
+ [symbol=emdash]
+
+\setupalign
+ [broad,right]
+
+\def\doTitlePage#1#2#3%
+ {\setups[fonts:normalize]
+ \resetsetups[fonts:normalize]
+ \startstandardmakeup[headerstate=high]
+ \def\\{\def\\{\endgraf\quad\quad}\endgraf\quad\ignorespaces#2}%
+ #1\setstrut\setupinterlinespace\vfil#3\vfil\vfil
+ \stopstandardmakeup}
+
+\unexpanded\def\TitlePage {\doTitlePage\TitleFont\relax}
+\unexpanded\def\SubTitlePage{\doTitlePage\TitleFont\SubTitleFont}
+
+\definehead[Topic][chapter]
+\definehead[Nopic][title]
+
+\unexpanded\def\Topics#1%
+ {\Nopic[topics]{#1}
+ \startcolumns
+ \placelist[Topic]
+ \stopcolumns}
+
+\setuplist
+ [Topic]
+ [alternative=f,
+ color=maincolor,
+ contrastcolor=maincolor,
+ criterium=all]
+
+\defineoverlay[topics][\overlaybutton{topics}]
+
+\setupbackgrounds
+ [bottom] [text]
+ [background=topics]
+
+\stopmodule
+
+\continueifinputfile{s-present-stepper.mkiv}
+
+\usemodule[present-common]
+
+\inputpresentationfile{examples/present-stepper-001.tex}
diff --git a/tex/context/modules/mkiv/s-present-stepwise.mkiv b/tex/context/modules/mkiv/s-present-stepwise.mkiv
new file mode 100644
index 000000000..bc781c499
--- /dev/null
+++ b/tex/context/modules/mkiv/s-present-stepwise.mkiv
@@ -0,0 +1,216 @@
+%D \module
+%D [ file=s-present-stepwise, % was s-pre-60
+%D version=2004.03.15,
+%D title=\CONTEXT\ Style File,
+%D subtitle=Presentation Environment Stepwise,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+% use lua instead of global mess
+
+\startmodule[present-stepwise]
+
+\unprotect
+
+\startmode[paper,print]
+ \let\StartSteps\relax
+ \let\StopSteps \relax
+ \let\FlushStep \relax
+ \let\ResetStep \relax
+ \let\StartBusy \relax
+ \let\StopBusy \relax
+ \endinput
+\stopmode
+
+\newcount\c_module_pre_steps_current
+\newcount\c_module_pre_steps_maximum
+\newcount\c_module_pre_steps_nesting_step
+\newcount\c_module_pre_steps_nesting_steps
+\newcount\c_module_pre_steps_nesting_busy
+
+\def\StepCounter {\the\c_module_pre_steps_current}
+\def\StepMaximum {\the\c_module_pre_steps_maximum}
+\def\StepLayer {step:\the\c_module_pre_steps_current}
+\def\NextStepLayer {step:\the\numexpr\c_module_pre_steps_current+\plusone\relax}
+\def\FirstStepLayer{step:1}
+
+\useJSscripts[stp]
+
+\startsetups[set-stepper]
+
+ \ifnum\getvariable{stepper}{nofsteps}>\c_module_pre_steps_maximum
+
+ \dostepwiserecurse {\numexpr\c_module_pre_steps_maximum+\plusone\relax} {\getvariable{stepper}{nofsteps}} {1} {
+ \doifnotmode{nosteps,nostep} {
+ \expanded{\defineviewerlayer[step:\recurselevel][state=stop,scope=global]}
+ }
+ }
+
+ \global\c_module_pre_steps_maximum\getvariable{stepper}{nofsteps}\relax
+
+ \fi
+
+\stopsetups
+
+\setvariables
+ [stepper]
+ [set=\setups{set-stepper},
+ nofsteps=50]
+
+\defineviewerlayer[step:busy][state=start]
+
+\definereference [SetupStepper] [JS(SetupStepper{step,\StepMaximum})]
+\definereference [ResetStepper] [JS(ResetStepper)]
+\definereference [CheckStepper] [JS(CheckStepper{\StepCounter})]
+\definereference [InvokeStepper] [JS(InvokeStepper)]
+
+% todo: roll back blank
+
+\unexpanded\def\ResetStep
+ {\iftrialtypesetting\else
+ \global\c_module_pre_steps_current\zerocount
+ \fi}
+
+\unexpanded\def\NextStep
+ {\iftrialtypesetting\else
+ \global\advance\c_module_pre_steps_current\plusone
+ \fi}
+
+\unexpanded\def\PrevStep
+ {\iftrialtypesetting\else
+ \global\advance\c_module_pre_steps_current\minusone
+ \fi}
+
+\unexpanded\def\FlushStep
+ {\iftrialtypesetting\else
+ \StopStep
+ \NextStep
+ \StartStep
+ \fi}
+
+\unexpanded\def\StartStep
+ {\iftrialtypesetting\else
+ \global\advance\c_module_pre_steps_nesting_step\plusone
+ \ifcase\c_module_pre_steps_nesting_step\or
+ \startviewerlayer[\StepLayer]%
+ \fi
+ \fi
+ \ignorespaces}
+
+\unexpanded\def\StopStep
+ {\removeunwantedspaces
+ \iftrialtypesetting\else
+ \ifcase\c_module_pre_steps_nesting_step\or
+ \stopviewerlayer
+ \fi
+ \global\advance\c_module_pre_steps_nesting_step\minusone
+ \fi}
+
+\unexpanded\def\StartSteps
+ {\iftrialtypesetting\else
+ \global\advance\c_module_pre_steps_nesting_steps\plusone
+ \ifcase\c_module_pre_steps_nesting_steps\or
+ \ResetStep
+ \NextStep
+ \StartStep
+ \fi
+ \fi}
+
+\unexpanded\def\StopSteps
+ {\iftrialtypesetting\else
+ \ifcase\c_module_pre_steps_nesting_steps\or
+ \StopStep
+ \PrevStep
+ \fi
+ \global\advance\c_module_pre_steps_nesting_steps\minusone
+ \fi}
+
+\unexpanded\def\StartBusy
+ {\iftrialtypesetting\else
+ \global\advance\c_module_pre_steps_nesting_busy\plusone
+ \ifcase\c_module_pre_steps_nesting_busy\or
+ \startviewerlayer[step:busy]
+ \fi
+ \fi
+ \ignorespaces}
+
+\unexpanded\def\StopBusy
+ {\removeunwantedspaces
+ \iftrialtypesetting\else
+ \ifcase\c_module_pre_steps_nesting_busy\or
+ \stopviewerlayer
+ \fi
+ \global\advance\c_module_pre_steps_nesting_busy\minusone
+ \fi}
+
+%D Handy:
+
+\unexpanded\def\StartLocalSteps
+ {\ResetStep}
+
+\unexpanded\def\StopLocalSteps
+ {}
+
+\unexpanded\def\StartLocalStep
+ {\NextStep
+ \StartStep}
+
+\unexpanded\def\StopLocalStep
+ {\StopStep}
+
+\appendtoks
+ \ResetStep
+\to \everyaftershipout
+
+\setupinteraction
+ [%openaction=SetupStepper,
+ closeaction=ResetStepper,
+ openpageaction=CheckStepper,
+ closepageaction=ResetStepper]
+
+\defineoverlay[invoke][\overlaybutton{InvokeStepper}]
+
+\setupbackgrounds
+ [text]
+ [background=invoke]
+
+% bonus
+
+\useMPlibrary[nav]
+
+\definepalet
+ [navplus]
+ [attach=interactioncolor,
+ comment=interactioncolor]
+
+\setupcomment
+ [symbol={comment-normal,comment-down},
+ textlayer=\StepLayer,
+ option=buffer,
+ height=\textheight,
+ width=\textwidth,
+ margin=0pt]
+
+\setupattachments
+ [symbol={attach-normal,attach-down},
+ textlayer=\StepLayer]
+
+%D used as (given some definitions):
+%D
+%D \starttyping
+%D \StartLocalSteps
+%D \startcombination[both]
+%D {\StartLocalStep\placestreamlayer[left]\StopLocalStep} {}
+%D {\StartLocalStep\placestreamlayer[right]\StopLocalStep} {}
+%D \stopcombination
+%D \StopLocalSteps
+%D \stoptyping
+
+\protect
+
+\stopmodule
diff --git a/tex/context/modules/mkiv/s-present-tiles.mkiv b/tex/context/modules/mkiv/s-present-tiles.mkiv
index b68a34ef4..566a610a4 100644
--- a/tex/context/modules/mkiv/s-present-tiles.mkiv
+++ b/tex/context/modules/mkiv/s-present-tiles.mkiv
@@ -11,15 +11,18 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-%D The Bacho\TeX\ 2013 style.
+%D In this style the table of contents is a bunch of rectangular blobs. The layout
+%D adapts itself upto 25 pages. This style was made for Bacho\TeX\ 2013.
+
+\startmodule[present-tiles]
\setupbodyfont[pagella,14.4pt]
\setuppapersize[S6][S6]
-\definecolor[primarycolor] [.50(darkblue,darkgreen)]
-\definecolor[secondarycolor][.25(darkblue,darkyellow)]
-\definecolor[mixedcolor] [s=.35]
+\definecolor[maincolor] [.50(darkblue,darkgreen)]
+\definecolor[othercolor][.25(darkblue,darkyellow)]
+\definecolor[mixedcolor][s=.35]
\setupcolors
[textcolor=white]
@@ -88,7 +91,7 @@
background=color,
frame=off,
foregroundstyle=MyTopicListFont,
- backgroundcolor=primarycolor,
+ backgroundcolor=maincolor,
foregroundcolor=white]
\setupwhitespace
@@ -171,7 +174,7 @@
frame=off]
\defineframed[nb] [bb] [empty=yes]
-\defineframed[rb] [bb] [backgroundcolor=white,foregroundcolor=secondarycolor]
+\defineframed[rb] [bb] [backgroundcolor=white,foregroundcolor=othercolor]
\defineframed[db] [bb] [backgroundcolor=mixedcolor,foregroundcolor=white]
\definepushbutton [prev]
@@ -235,7 +238,7 @@
align={flushleft,lohi},
background=color,
backgroundcolor=white,
- foregroundcolor=secondarycolor]
+ foregroundcolor=othercolor]
\startsetups [document:titlepage]
@@ -245,12 +248,12 @@
\setupbackgrounds
[page]
[background={color,menupage},
- backgroundcolor=secondarycolor]
+ backgroundcolor=othercolor]
\setupbackgrounds
[text]
[background={color,menupage},
- backgroundcolor=secondarycolor]
+ backgroundcolor=othercolor]
\starttopicmakeup[reference=homepage]
@@ -277,12 +280,12 @@
\setupbackgrounds
[page]
[background={color,homepage},
- backgroundcolor=secondarycolor]
+ backgroundcolor=othercolor]
\setupbackgrounds
[text]
[background={color,menupage},
- backgroundcolor=secondarycolor]
+ backgroundcolor=othercolor]
\startcontentmakeup[reference=menupage]
@@ -296,23 +299,33 @@
[page]
% [background={color,menupage},
[background={color,invoke},
- backgroundcolor=primarycolor]
+ backgroundcolor=maincolor]
\setupbackgrounds
[text]
% [background={color,nextpage,setbuttons,buttons},
[background={color,setbuttons,buttons},
- backgroundcolor=secondarycolor]
+ backgroundcolor=othercolor]
\stopsetups
\setupdocument
[before=\directsetup{document:titlepage}]
-\continueifinputfile{s-present-tiles.mkiv}
-
-\startdocument[title=Whatever We\\Want Here,subtitle=Whatever We\\Want There]
+\stopmodule
- \dorecurse{12}{\starttopic[title=Topic #1]\input tufte \stoptopic}
+\continueifinputfile{s-present-tiles.mkiv}
-\stopdocument
+\usemodule[present-common]
+
+%inputpresentationfile{examples/present-tiles-001.tex}
+%inputpresentationfile{context/2013/context-2013-speed.tex}
+\inputpresentationfile{context/2013/context-2013-math.tex}
+%inputpresentationfile{bachotex/2013/bachotex-2013-bits.tex}
+%inputpresentationfile{bachotex/2013/bachotex-2013-bits.pdf}
+%inputpresentationfile{bachotex/2013/bachotex-2013-luatex.tex}
+%inputpresentationfile{bachotex/2013/bachotex-2013-luatex.pdf}
+%inputpresentationfile{bachotex/2013/bachotex-2013-sense.tex}
+%inputpresentationfile{bachotex/2013/bachotex-2013-sense.pdf}
+%inputpresentationfile{bachotex/2013/bachotex-2013-speed.tex}
+%inputpresentationfile{bachotex/2013/bachotex-2013-speed.pdf}
diff --git a/tex/context/modules/mkiv/s-present-windows.mkiv b/tex/context/modules/mkiv/s-present-windows.mkiv
new file mode 100644
index 000000000..22d6fdba1
--- /dev/null
+++ b/tex/context/modules/mkiv/s-present-windows.mkiv
@@ -0,0 +1,350 @@
+%D \module
+%D [ file=s-resent-windows, % was s-pre-09
+%D version=unknown,
+%D title=\CONTEXT\ Style File,
+%D subtitle=Presentation Environment Windows,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+\startmodule[present-windows]
+
+%D I made this style when I had to give a presentation on the \MAPS\ bibliography
+%D production for several user group meetings. This style is rather tuned for
+%D combinations of examples and explanations. The colors match the \MAPS\
+%D bibliography colors.
+
+\doifelsemode {asintended} {
+ \setupbodyfont[ludicaot,14.4pt]
+} {
+ \setupbodyfont[pagella,14.4pt]
+}
+
+%D A couple of years later, in 2001 this style was documented and made public. While
+%D documenting, I also changed box building on top of overlays into the now
+%D available layer positioning. So, this styles demonstrates quite some tricks.
+%D
+%D I'm sure that nowadays it can be done with less code but therei sno real need to
+%D rewrite history.
+
+\setuppapersize
+ [S6][S6]
+
+\setuplayout
+ [topspace=0cm,
+ backspace=0cm,
+ header=0pt,
+ footer=0pt,
+ width=middle,
+ height=middle]
+
+%D Local environments can be set by using the setups commands. For downward
+%D compatibility, we keep supporting the \type {\...Settings} hooks. Using local
+%D environments is seldom needed.
+
+\let\TextSettings \empty
+\let\SampleSettings\empty
+
+\startsetups [text] \TextSettings \stopsetups
+\startsetups [sample] \SampleSettings \stopsetups
+
+%D The dimensions are kind of fixed.
+
+\def\FrameWidth {448pt}
+\def\FrameHeight {348pt}
+\def\FrameOffset {24pt}
+\def\FrameSkip {12pt}
+
+%D But they {\em can} and {\em will} be changed.
+
+\def\FrameWidth {408pt}
+\def\FrameHeight {318pt}
+
+%D The funny values come from the $3:4$ display aspect ratio.
+
+\definecolor[PageColor] [s=.40]
+\definecolor[TextColor] [s=.90]
+\definecolor[InteractionColor][r=.40]
+\definecolor[LineColor] [r=.60,g=.60]
+
+%D Of course we go interactive and since we will probably open other documents, we
+%D make sure that the viewer opens a new window.
+
+\setupinteraction
+ [color=InteractionColor,
+ contrastcolor=LineColor,
+ display=new,
+ state=start]
+
+\setupinteractionscreen
+ [option=max]
+
+%D Before we come to the real macros, we do a little bit of tuning.
+
+\setupitemize
+ [1][packed]
+
+\setuptyping
+ [blank=medium]
+
+%D Apart from the titlepage, the page gets a simple colored background. Later we
+%D will activate the background.
+
+\setupbackgrounds
+ [page]
+ [backgroundcolor=PageColor]
+
+%D Everything gets frames by a nice \METAPOST\ frame.
+
+\defineoverlay [background] [\uniqueMPgraphic{background}]
+
+\startuniqueMPgraphic{background}
+ pickup pencircle scaled (1.5*\FrameSkip) ;
+ draw OverlayBox withcolor "PageColor" ;
+ pickup pencircle scaled \FrameSkip ;
+ fill OverlayBox withcolor "TextColor" ;
+ draw OverlayBox withcolor "LineColor" ;
+\stopuniqueMPgraphic
+
+%D We will present samples and explanation pair||wise, so we need a hyperlink that
+%D skips a page. Contrary to \MKII\ we put the next button in the page background and
+%D the two windows get buttons that toggle between them. This is easier.
+
+\defineoverlay [nextpage] [\overlaybutton{nextpage}]
+\defineoverlay [previouspage] [\overlaybutton{previouspage}]
+\defineoverlay [skippage] [\overlaybutton{realpage(\number\numexpr\realpageno+2\relax)}]
+\defineoverlay [samepage] [\overlaybutton{realpage(\number\numexpr\realpageno \relax)}]
+
+%D Layers are normally used to position multiple content on a specific overlay. Here
+%D we will use them to position only and since the samples and text will swap place,
+%D we will use quite a few layers.
+
+\defineoverlay [text] [\composedlayer{text}]
+\defineoverlay [sample] [\composedlayer{sample}]
+\defineoverlay [common] [\composedlayer{common}]
+
+%D There are three positions. When combined, the sample and text windows overlap,
+%D otherwise the lone window is centered. We could have used one layer and reversed
+%D the order by setting the \type {direction} parameter, but this approach is more
+%D readable.
+
+\definelayer
+ [text]
+ [x=\makeupwidth,
+ y=\makeupheight,
+ location=lt,
+ hoffset=-\FrameSkip,
+ voffset=-\FrameSkip]
+
+\definelayer
+ [sample]
+ [hoffset=\FrameSkip,
+ voffset=\FrameSkip]
+
+\definelayer
+ [common]
+ [x=.5\makeupwidth,
+ y=.5\makeupheight,
+ location=c]
+
+%D The topic is put in the lower right corner of the text window.
+
+\defineoverlay [topic] [\composedlayer{topic}]
+
+\definelayer
+ [topic]
+ [x=\FrameWidth,
+ y=\FrameHeight,
+ location=lt,
+ hoffset=-\FrameOffset,
+ voffset=-\FrameSkip]
+
+%D The topic is put in a framed box. That way we can make sure that it gets a
+%D background, which looks better when it covers something else. Otherwise we could
+%D have stuck to:
+%D
+%D \starttyping
+%D \def\Topic#1%
+%D {\setlayer[topic]{\color[PageColor]{\bfb\setstrut#1}}}
+%D \stoptyping
+%D
+%D But, we go for the nice alternative:
+
+\unexpanded\def\Topic#1%
+ {\doifsomething{#1}
+ {\setlayer [topic]
+ {\bfb\setstrut
+ \inframed
+ [frame=off,
+ foregroundcolor=PageColor,
+ offset=0pt,
+ background=color,
+ backgroundcolor=TextColor]
+ {#1}}}}
+
+%D The sample as well as the explanation will be collected in a buffer. That way we
+%D can reuse the content. We could have used a box instead, but can we be sure that
+%D the content is not adapting itself? So, buffers we use.
+
+\resetbuffer[sample]
+\resetbuffer[text]
+
+%D Both the sample and explanation are kind of windowed.
+
+\defineframedtext
+ [SampleText]
+ [width=\FrameWidth,
+ height=\FrameHeight,
+ offset=\FrameOffset,
+ frame=off,
+ align=normal,
+ strut=no,
+ before=,
+ after=,
+ background=background]
+
+%D We safe some keying in by combining things in one macro.
+
+\unexpanded\def\DoSampleText#1#2#3% kind layer overlays
+ {\setupframedtexts[SampleText][background={background,#3}]
+ \setlayer[#2]
+ {\startSampleText[none]
+ \setups[#1]
+ \getbuffer[#1]
+ \stopSampleText}}
+
+\unexpanded\def\StartSample{\dostartbuffer[sample][StartSample][StopSample]}
+\unexpanded\def\StartText {\dostartbuffer[text] [StartText] [StopText]}
+
+%D The following definitions apply at the outer level.
+
+\unexpanded\def\StopSample
+ {\startstandardmakeup
+ \DoSampleText{sample}{common}{samepage}
+ \stopstandardmakeup
+ \resetbuffer[sample]}
+
+\unexpanded\def\StopText
+ {\startstandardmakeup
+ \DoSampleText{text}{common}{topic,samepage}
+ \stopstandardmakeup
+ \resetbuffer[text]}
+
+\setupbackgrounds[page][background={color,nextpage}]
+\setupbackgrounds[text][background=common]
+
+%D When we combine sample and text, we get slightly different definitions. As you
+%D can see we generate two pages. Watch how we manipulate the order of the overlays
+%D and teh nature of the buttons. Here some abstraction really pays off.
+
+\unexpanded\def\StartIdea
+ {\bgroup
+ \let\StopSample\relax
+ \let\StopText \relax}
+
+\unexpanded\def\StopIdea
+ {\setupbackgrounds[page][background={color,skippage}]
+ \setupbackgrounds[text][background={text,sample}]
+ \startstandardmakeup
+ \DoSampleText{sample}{sample}{nextpage}
+ \DoSampleText{text} {text} {topic,nextpage}
+ \stopstandardmakeup
+ \setupbackgrounds[page][background={color,nextpage}]
+ \setupbackgrounds[text][background={sample,text}]
+ \startstandardmakeup
+ \DoSampleText{sample}{sample}{previouspage}
+ \DoSampleText{text} {text} {topic,previouspage}
+ \stopstandardmakeup
+ \egroup}
+
+%D The rest of the definitions takes care of the title page. Please don't steal this
+%D one for your own documents.
+
+\defineoverlay[joke] [\useMPgraphic{joke}{n=0}] % not to be changed!
+
+\startuseMPgraphic{joke}{n}
+ StartPage ;
+ path p, q ; numeric w ; pair xy ;
+ set_grid(OverlayWidth,OverlayHeight,OverlayWidth/8,OverlayHeight/8) ;
+ if \MPvar{n}=1 :
+ p := fulldiamond ; fill Page withcolor \MPcolor{TextColor} ;
+ else :
+ p := fullsquare ; fill Page withcolor \MPcolor{PageColor} ;
+ fi ;
+ forever :
+ xy := center Page randomized (OverlayWidth,OverlayHeight) ;
+ if new_on_grid(xpart xy, ypart xy) :
+ q := (p xyscaled (OverlayWidth/5,OverlayHeight/5))
+ randomized (\FrameSkip,\FrameSkip)
+ shifted xy ;
+ w := (\FrameSkip) randomized (\FrameSkip/2) ;
+ draw q withcolor \MPcolor{PageColor} withpen pencircle scaled (1.5w) ;
+ fill q withcolor \MPcolor{TextColor} ;
+ draw q withcolor \MPcolor{LineColor} withpen pencircle scaled ( w) ;
+ fi ;
+ exitif grid_full ;
+ endfor ;
+ StopPage ;
+\stopuseMPgraphic
+
+\defineoverlay[fuzzy][\useMPgraphic{fuzzy}]
+
+\startuseMPgraphic{fuzzy}
+ path p ; numeric w ;
+ p := (fullsquare xyscaled (OverlayWidth,OverlayHeight))
+ randomized (\FrameSkip,\FrameSkip) ;
+ w := (\FrameSkip) randomized (\FrameSkip/2) ;
+ draw p withcolor \MPcolor{PageColor} withpen pencircle scaled (1.5w) ;
+ fill p withcolor \MPcolor{TextColor} ;
+ draw p withcolor \MPcolor{LineColor} withpen pencircle scaled ( w) ;
+\stopuseMPgraphic
+
+%D This time we use a fit window, but with a slightly randomized frame, our
+%D trademark so to say.
+
+\unexpanded\def\StartTitlePage
+ {\bgroup
+ \setupbackgrounds[page][background={joke,nextpage}]
+ \startstandardmakeup
+ \switchtobodyfont[big]
+ \setupframedtexts
+ [SampleText]
+ [background=fuzzy,
+ foregroundcolor=PageColor,
+ width=fit,
+ height=fit,
+ align=middle]
+ \startSampleText[middle]
+ \bfd\setupinterlinespace
+ \def\\{\bfb\setupinterlinespace\vfil\def\\{\vfil}}}
+
+\unexpanded\def\StopTitlePage
+ {\stopSampleText
+ \stopstandardmakeup
+ \egroup}
+
+\unexpanded\def\TitlePage#1%
+ {\StartTitlePage#1\StopTitlePage}
+
+%D Let's nil some error prone presentation macros.
+
+\let\Subject \Topic
+\let\Topics \gobbleoneargument
+\let\Subjects \relax
+
+%D We will avoid \quote {overfull} messages.
+
+\dontcomplain
+
+\stopmodule
+
+\continueifinputfile{s-present-windows.mkiv}
+
+\usemodule[present-common]
+
+\inputpresentationfile{examples/present-windows-001.tex}
+
diff --git a/tex/context/modules/mkiv/s-present-wobbling.mkiv b/tex/context/modules/mkiv/s-present-wobbling.mkiv
new file mode 100644
index 000000000..e61b262f4
--- /dev/null
+++ b/tex/context/modules/mkiv/s-present-wobbling.mkiv
@@ -0,0 +1,339 @@
+%D \module
+%D [ file=s-prent-wobbling,
+%D version=2010.04.28,
+%D title=\CONTEXT\ Style File,
+%D subtitle=Presentation Environment Wobbling,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+%D This a bit old stuyls and I should adapt it a bit but as it sort of works ok I'll
+%D not do that now.
+
+\startmodule[present-wobbling]
+
+%setuppapersize[S6][S6]
+\setuppapersize[SM][SM]
+
+\setupinteraction
+ [state=start,
+ contrastcolor=white,
+ color=white,
+ click=no]
+
+\setuplayout
+ [location=middle,
+ topspace=60pt,
+ bottomspace=80pt,
+ backspace=80pt,
+ header=0pt,
+ footer=0pt,
+ width=middle,
+ height=middle]
+
+\setupcolors
+ [textcolor=white]
+
+\setupbodyfont[pagella]
+
+\definecolor[maincolor] [blue]
+\definecolor[extracolor][green]
+
+% \definecolor[maincolor] [red]
+% \definecolor[extracolor][blue]
+
+\startMPdefinitions
+ picture MySoFar ; MySoFar := nullpicture ;
+ path MyLastOne ; MyLastOne := origin -- cycle ;
+ path MyLeftSteps, MyRightSteps ;
+ boolean MyPageDone ; MyPageDone := false ;
+
+ vardef MySmallShape(expr parent) =
+ path p ; p := boundingbox parent ;
+ numeric w, h ; w := bbwidth(p) ; h := bbheight(p) ;
+ urcorner p shifted (-uniformdeviate w/4,0) --
+ lrcorner p shifted (0,uniformdeviate h/4) --
+ llcorner p shifted (uniformdeviate w/4,0) --
+ ulcorner p shifted (0,-uniformdeviate h/4) -- cycle
+ enddef ;
+
+ vardef MyShape(expr parent) =
+ path p ; p := boundingbox parent ;
+ if MyPageDone :
+ MyPageDone := false ;
+ urcorner p shifted (-EmWidth + -uniformdeviate CutSpace/2,0) --
+ lrcorner p shifted (0,EmWidth + uniformdeviate BottomSpace/2) --
+ llcorner p shifted (EmWidth + uniformdeviate BackSpace/2,0) --
+ ulcorner p shifted (0,-EmWidth + -uniformdeviate TopSpace/2) -- cycle
+ else :
+ MyPageDone := true ;
+ urcorner p shifted (0,-EmWidth + -uniformdeviate TopSpace/2) --
+ lrcorner p shifted (-EmWidth + -uniformdeviate CutSpace/2,0) --
+ llcorner p shifted (0,EmWidth + uniformdeviate BottomSpace/2) --
+ ulcorner p shifted (EmWidth + uniformdeviate BackSpace/2,0) -- cycle
+ fi
+ enddef ;
+
+ vardef MyMakeOne =
+ MyLastOne := MyShape(Page) ;
+ enddef ;
+
+ vardef MyAddOne =
+ addto MySoFar also image(fill MyLastOne withcolor "maincolor" withtransparency(1,.25) ; ) ;
+ enddef ;
+
+ vardef MyDrawOne =
+ fill MyLastOne withcolor black ;
+ fill MyLastOne withcolor "maincolor" withtransparency(1,.25) ;
+ enddef ;
+
+ vardef MyDrawPage =
+ draw MySoFar ;
+ enddef ;
+
+ vardef MySetSteps =
+ path l, r ; numeric s ; path ll[], rr[] ; path t ;
+ l := point 2 of MyLastOne -- point 3 of MyLastOne ;
+ r := point 0 of MyLastOne -- point 1 of MyLastOne ;
+ t := topboundary Field[Text][Text] rightenlarged TextWidth leftenlarged TextWidth ;
+ s := bbheight(Field[Text][Text])/LineHeight + 2 ;
+ t := t shifted (0,-TopSkip) ;
+ for i=1 upto s :
+ ll[i] := t intersectionpoint l ;
+ rr[i] := t intersectionpoint r ;
+ t := t shifted (0,-LineHeight) ;
+ endfor ;
+ MyLeftSteps := for i=1 upto s : ll[i] -- endfor cycle ;
+ MyRightSteps := for i=1 upto s : rr[i] -- endfor cycle ;
+ enddef ;
+
+ vardef MyDrawText(expr txt) =
+ pair a ; a := (point 1 of MyLastOne) - (point 2 of MyLastOne) ;
+ picture p ; p := txt ;
+ p := p
+ shifted (-EmWidth,EmWidth)
+ shifted ulcorner txt
+ shifted point 1 of MyLastOne ;
+ p := p rotatedaround(lrcorner p, radian * tan(ypart a/xpart a)) ;
+ setbounds p to origin -- cycle ;
+ draw p ;
+ enddef ;
+
+ vardef MyDrawTitle(expr txt) =
+ % pair a ; a := (point 2 of MyLastOne) - (point 3 of MyLastOne) ;
+ pair a ; a := (point 3 of MyLastOne) - (point 4 of MyLastOne) ;
+ picture p ;
+ if bbheight(txt) > bbwidth(txt) :
+ p := txt ysized(0.8*TextHeight) ;
+ else :
+ p := txt xsized(0.8*TextWidth) ;
+ fi ;
+ numeric d ; d := arclength(point 2 of MyLastOne -- point 3 of MyLastOne) - bbheight(p) ;
+ p := p
+ shifted (BackSpace,-d/2)
+ shifted -ulcorner p
+ shifted point 3 of MyLastOne ;
+ % p := p rotatedaround(ulcorner p, - radian * tan(xpart a/ypart a)) ;
+ % p := p rotatedaround(ulcorner p, radian * tan(ypart a/xpart a)) ;
+ setbounds p to origin -- cycle ;
+ draw p ;
+ enddef ;
+
+ vardef MyDrawSteps =
+ s := bbheight(Field[Text][Text])/LineHeight + 2 ;
+ for i=1 upto s :
+ draw ll[i] withpen pencircle scaled 1mm ;
+ draw rr[i] withpen pencircle scaled 1mm ;
+ draw ll[i] -- rr[i] ;
+ endfor ;
+ draw Field[Text][Text] ;
+ enddef ;
+
+\stopMPdefinitions
+
+\startuseMPgraphic{initialization}
+ StartPage ;
+ MySoFar := image(fill Page enlarged 12pt withcolor "maincolor" withtransparency(1,.25) ;) ;
+ MyMakeOne ;
+ MySetSteps ;
+ StopPage ;
+\stopuseMPgraphic
+
+\appendtoks
+ \startnointerference
+ \useMPgraphic{initialization}
+ \stopnointerference
+\to \everystarttext
+
+\unexpanded\def\TitleCommand#1%
+ {\framed
+ [frame=off,
+ offset=overlay,
+ align=flushleft,
+ foregroundcolor=white,
+ foregroundstyle={\tfd},
+ bottom=\vskip2\lineheight]
+ {\setupinterlinespace
+ \setupwhitespace[halfline]%
+ %\showstruts
+ \begstrut
+ #1%
+ \endstrut}}
+
+\unexpanded\def\TopicCommand#1%
+ {\color[white]{\tfb#1}}
+
+\startuseMPgraphic{page}
+ StartPage ;
+ MyDrawPage ;
+ MyDrawOne ;
+ MySetSteps ;
+ if RealPageNumber == 1 :
+ MyDrawTitle(textext("\TitleCommand{\documentvariable{title}}")) ;
+ MyDrawText (textext("\TopicCommand{\documentvariable{topic}}")) ;
+ fi ;
+ %
+ % we have multiple runs when we have text
+ %
+ % MyDrawSteps ;
+ % MyMakeOne ;
+ % MySetSteps ;
+ StopPage ;
+\stopuseMPgraphic
+
+\appendtoks
+ \startnointerference
+ \startMPcode
+ MyAddOne ;
+ MyMakeOne ;
+ MySetSteps ;
+ \stopMPcode
+ \stopnointerference
+\to \everyshipout
+
+\defineoverlay[page][\useMPgraphic{page}]
+
+\startuseMPgraphic{symbol}
+ path p ; p := MySmallShape(unitsquare scaled (.6*LineHeight)) ;
+ fill p withcolor white ;
+ fill p withcolor "extracolor" withtransparency(1,.25) ;
+\stopuseMPgraphic
+
+\definesymbol[mysymbol][\struttedbox{\useMPgraphic{symbol}}]
+
+\setupitemgroup
+ [itemize] [1]
+ [symbol=mysymbol]
+
+\setupbackgrounds
+ [page]
+ [background=page]
+
+\startluacode
+ local texdimen = tex.dimen
+ function document.SetParShape()
+ local leftpath = metapost.getclippath { mpx = "metafun", data = "clip currentpicture to MyLeftSteps ;" }
+ local rightpath = metapost.getclippath { mpx = "metafun", data = "clip currentpicture to MyRightSteps ;" }
+ local shape = { }
+ for i=1,#leftpath do
+ local left = leftpath[i].x_coord
+ local right = rightpath[i].x_coord
+ local hsize = right - left - (texdimen.backspace + texdimen.cutspace)*number.dimenfactors.bp
+ shape[#shape+1] = string.format("%sbp %sbp",left,hsize)
+ end
+ -- print(table.serialize(shape))
+ -- context.parshape(string.format("%s %s ",#shape,table.concat(shape," ")))
+ context("\\parshape %s %s ",#shape,table.concat(shape," "))
+ end
+\stopluacode
+
+\nopenalties \dontcomplain
+
+\setupwhitespace[none]
+
+\startsetups document:start
+ \bgroup
+ \let\crlf\endgraf % \par in a mp textext doesn't work well
+ \startstandardmakeup
+ % dummy page
+ \stopstandardmakeup
+ \egroup
+\stopsetups
+
+\unexpanded\def\StartText#1#2% for old times sake
+ {\startdocument[title={#1},subtitle={#2}]}
+
+\unexpanded\def\StopText
+ {\stopdocument
+ \setupdocument[title=,topic=]}
+
+\unexpanded\def\StartItems#1%
+ {\setupdocument[topic={#1}]
+ \startstandardmakeup[top=,bottom=\vss]
+ \startelement[items][title={#1}]%
+ \ctxlua{document.SetParShape()}
+ \StartSteps}
+
+\unexpanded\def\StopItems
+ {\StopSteps
+ \stopelement
+ \stopstandardmakeup}
+
+\unexpanded\def\StartItem
+ {\dontleavehmode
+ \startelement[item]%
+ \llap{\symbol[mysymbol]\quad}% graphic
+ \ignorespaces}
+
+\unexpanded\def\StopItem
+ {\removeunwantedspaces
+ \nobreak
+ \crlf
+ \stopelement
+ \crlf
+ \FlushStep}
+
+\unexpanded\def\ShapeParagraph
+ {\ctxlua{document.SetParShape()}}
+
+% no parshape yet
+
+\unexpanded\def\StartParagraphs#1%
+ {\setupdocument[topic={#1}]
+ \startstandardmakeup[top=,bottom=\vss]
+ %\ctxlua{document.SetParShape()}
+ \startelement[paragraphs]%
+ \StartSteps}
+
+\unexpanded\def\StopParagraphs
+ {\StopSteps
+ \stopelement
+ \stopstandardmakeup}
+
+\unexpanded\def\StartParagraph
+ {\startelement[paragraph]}
+
+\unexpanded\def\StopParagraph
+ {\par
+ \stopelement
+ \FlushStep}
+
+% experiment .. likely to change
+
+\setelementexporttag[items] [nature][display]
+\setelementexporttag[item] [nature][mixed]
+\setelementexporttag[paragraphs][nature][display]
+\setelementexporttag[paragraph] [nature][mixed]
+
+\stopmodule
+
+\continueifinputfile{s-present-wobbling.mkiv}
+
+\usemodule[present-common]
+
+%inputpresentationfile{bachotex/2010/bachotex-2010-clash.tex}
+\inputpresentationfile{bachotex/2010/bachotex-2010-move.tex}
diff --git a/tex/context/modules/mkiv/s-syntax.mkiv b/tex/context/modules/mkiv/s-syntax.mkiv
index 96312f771..d9492af3e 100644
--- a/tex/context/modules/mkiv/s-syntax.mkiv
+++ b/tex/context/modules/mkiv/s-syntax.mkiv
@@ -31,7 +31,7 @@
\unexpanded\def\module_syntax_Tex #1{\Sugar{\type{#1}}}
\unexpanded\def\module_syntax_Literal #1{\Sugar{\type{#1}}}
\unexpanded\def\module_syntax_Syntax #1{\strut\kern-.25em{#1}\kern-.25em}
-\unexpanded\def\module_syntax_Next {\crlf\hbox to 2em{}\nobreak}
+\unexpanded\def\module_syntax_Next {\par\strut\kern4em} % {\crlf\hbox to 2em{}\nobreak}
\unexpanded\def\module_syntax_Whatever #1{\Sugar{\mathematics{(\hbox{#1})}}}
\unexpanded\def\module_syntax_Quote #1{\Sugar{\quote{#1}}}
\unexpanded\def\module_syntax_Or {\Sugar{\module_syntax_Indent{\mathematics{\vert}}}}
@@ -70,6 +70,7 @@
\let\L \module_syntax_Literal
\let\S \module_syntax_Something
\let\M \module_syntax_Means
+ \let\N \module_syntax_Next
\let\O \module_syntax_Or
\let\Q \module_syntax_Quote
\let\LB \module_syntax_Lbrace
diff --git a/tex/context/modules/mkiv/s-xml-analyzers.lua b/tex/context/modules/mkiv/s-xml-analyzers.lua
index c356d4c37..6e7f7f2ba 100644
--- a/tex/context/modules/mkiv/s-xml-analyzers.lua
+++ b/tex/context/modules/mkiv/s-xml-analyzers.lua
@@ -11,6 +11,8 @@ moduledata.xml.analyzers = moduledata.xml.analyzers or { }
local next, type = next, type
local utfvalues = string.utfvalues
+local formatters = string.formatters
+local setmetatableindex = table.setmetatableindex
local context = context
local NC, NR, HL, FL, LL, SL, TB = context.NC, context.NR, context.HL, context.TB, context.FL, context.LL, context.SL
local sortedhash, sortedkeys, concat, sequenced = table.sortedhash, table.sortedkeys, table.concat, table.sequenced
@@ -43,28 +45,29 @@ local function analyze(filename)
attr = { }
ents = { }
- table.setmetatableindex(tags,function(t,k)
+ local function att(t,k)
+ local v = setmetatableindex("number")
+ t[k] = v
+ return v
+ end
+
+ local function add(t,k)
local v = {
n = 0,
- attributes = { },
- children = { },
+ attributes = setmetatableindex(att),
+ children = setmetatableindex(add),
}
t[k] = v
return v
- end)
+ end
- table.setmetatableindex(char,function(t,k)
- t[k] = 0
- return 0
- end)
+ setmetatableindex(tags,add)
- table.setmetatableindex(attr,function(t,k)
- char[k] = char[k] or 0
- t[k] = 0
- return 0
- end)
+ setmetatableindex(ents,"number")
+ setmetatableindex(char,"number")
- table.setmetatableindex(ents,function(t,k)
+ setmetatableindex(attr,function(t,k)
+ char[k] = char[k] or 0
t[k] = 0
return 0
end)
@@ -85,24 +88,25 @@ local function analyze(filename)
local tg = e.tg
local tag = tags[tg]
tag.n = tag.n + 1
+ local children = parent and tags[parent].children[tg]
+ local childatt = children and children.attributes
+ if children then
+ children.n = children.n + 1
+ end
if at then
local attributes = tag.attributes
for k, v in next, at do
local a = attributes[k]
- if a then
- a[v] = (a[v] or 0) + 1
- else
- attributes[k] = { [v] = 1 }
+ a[v] = a[v] + 1
+ if childatt then
+ local a = childatt[k]
+ a[v] = a[v] + 1
end
for s in utfvalues(v) do
attr[s] = attr[s] + 1
end
end
end
- if parent then
- local children = tags[parent].children
- children[tg] = (children[tg] or 0) + 1
- end
if dt then
for i=1,#dt do
local d = dt[i]
@@ -119,7 +123,11 @@ local function analyze(filename)
end
for i=1,#filename do
- local root = xml.load(filename[i])
+ local name = filename[i]
+ local root = xml.load(name)
+ --
+ logs.report("xml analyze","loaded: %s",name)
+ --
collect(root)
--
local names = root.statistics.entities.names
@@ -128,10 +136,10 @@ local function analyze(filename)
end
end
- table.setmetatableindex(tags,nil)
- table.setmetatableindex(char,nil)
- table.setmetatableindex(attr,nil)
- table.setmetatableindex(ents,nil)
+ setmetatableindex(tags,nil)
+ setmetatableindex(char,nil)
+ setmetatableindex(attr,nil)
+ setmetatableindex(ents,nil)
end
@@ -153,16 +161,20 @@ function moduledata.xml.analyzers.structure(filename)
NC() context.bold("element") NC() context.darkred(name) NC() NR()
NC() context.bold("frequency") NC() context(data.n) NC() NR()
if next(children) then
- NC() context.bold("children") NC() context.puretext(sequenced(children)) NC() NR()
+ local t = { }
+ for k, v in next, children do
+ t[k] = v.n
+ end
+ NC() context.bold("children") NC() context.puretext(sequenced(t)) NC() NR()
end
if next(attributes) then
NC() context.bold("attributes") NC() context.puretext.darkgreen(concat(sortedkeys(attributes)," ")) NC() NR()
for attribute, values in sortedhash(attributes) do
local n = table.count(values)
if attribute == "id" or attribute == "xml:id" or n > maxnofattributes then
- NC() context(attribute) NC() context("%s different values",n) NC() NR()
+ NC() context("@%s",attribute) NC() context("%s different values",n) NC() NR()
else
- NC() context(attribute) NC() context.puretext(sequenced(values)) NC() NR()
+ NC() context("@%s",attribute) NC() context.puretext(sequenced(values)) NC() NR()
end
end
end
@@ -195,4 +207,121 @@ function moduledata.xml.analyzers.entities(filename)
context.stoptabulate()
end
+local f_parent_s = formatters["xml:%s"]
+local f_parent_n = formatters["\\startxmlsetups xml:%s\n \\xmlflush{#1}\n\\stopxmlsetups"]
+local f_parent_a = formatters["\\startxmlsetups xml:%s\n %% @ % t\n \\xmlflush{#1}\n\\stopxmlsetups"]
+local f_child_s = formatters["xml:%s:%s"]
+local f_child_n = formatters["\\startxmlsetups xml:%s:%s\n \\xmlflush{#1}\n\\stopxmlsetups"]
+local f_child_a = formatters["\\startxmlsetups xml:%s:%s\n %% @ % t\n \\xmlflush{#1}\n\\stopxmlsetups"]
+
+local f_template = formatters [ [[
+%% file: %s
+
+%% Beware, these are all (first level) setups. If you have a complex document
+%% it often makes sense to use \\xmlfilter or similar local filter options.
+
+%% presets
+
+\startxmlsetup xml:presets:all
+ \xmlsetsetups {#1} {
+ %s
+ }
+\stopxmlsetups
+
+%% setups
+
+%s
+]] ]
+
+function moduledata.xml.analyzers.allsetups(filename,usedname)
+ analyze(filename)
+ local result = { }
+ local setups = { }
+ for name, data in table.sortedhash(tags) do
+ local children = data.children
+ local attributes = data.attributes
+ if next(attributes) then
+ result[#result+1] = f_parent_a(name,sortedkeys(attributes))
+ else
+ result[#result+1] = f_parent_n(name)
+ end
+ setups[#setups+1] = f_parent_s(name)
+ if next(children) then
+ for k, v in sortedhash(children) do
+ local attributes = v.attributes
+ if next(attributes) then
+ result[#result+1] = f_child_a(name,k,sortedkeys(attributes))
+ else
+ result[#result+1] = f_child_n(name,k)
+ end
+ setups[#setups+1] = f_child_s(name,k)
+ end
+ end
+ end
+ table.sort(setups)
+ --
+ if type(filename) == "table" then
+ filename = concat(filename," | ")
+ end
+ --
+ usedname = usedname or "xml-analyze-template.tex"
+ --
+ io.savedata(usedname,f_template(filename,concat(setups,"|\n "),concat(result,"\n\n")))
+ logs.report("xml analyze","presets saved in: %s",usedname)
+end
+
+-- example:
+
+-- local t = { }
+-- local x = xml.load("music-collection.xml")
+-- for c in xml.collected(x,"//*") do
+-- if not c.special and not t[c.tg] then
+-- t[c.tg] = true
+-- end
+-- end
+-- inspect(table.sortedkeys(t))
+
+-- xml.finalizers.taglist = function(collected)
+-- local t = { }
+-- for i=1,#collected do
+-- local c = collected[i]
+-- if not c.special then
+-- local tg = c.tg
+-- if tg and not t[tg] then
+-- t[tg] = true
+-- end
+-- end
+-- end
+-- return t
+-- end
+-- local x = xml.load("music-collection.xml")
+-- inspect(table.sortedkeys(xml.applylpath(x,"//*/taglist()")))
+
+-- xml.finalizers.taglist = function(collected,parenttoo)
+-- local t = { }
+-- for i=1,#collected do
+-- local c = collected[i]
+-- if not c.special then
+-- local tg = c.tg
+-- if tg and not t[tg] then
+-- t[tg] = true
+-- end
+-- if parenttoo then
+-- local p = c.__p__
+-- if p and not p.special then
+-- local tg = p.tg .. ":" .. tg
+-- if tg and not t[tg] then
+-- t[tg] = true
+-- end
+-- end
+-- end
+-- end
+-- end
+-- return t
+-- end
+
+-- local x = xml.load("music-collection.xml")
+-- inspect(table.sortedkeys(xml.applylpath(x,"//*/taglist()")))
+-- local x = xml.load("music-collection.xml")
+-- inspect(table.sortedkeys(xml.applylpath(x,"//*/taglist(true)")))
diff --git a/tex/context/modules/mkiv/s-xml-analyzers.mkiv b/tex/context/modules/mkiv/s-xml-analyzers.mkiv
index af11fc984..4104f023a 100644
--- a/tex/context/modules/mkiv/s-xml-analyzers.mkiv
+++ b/tex/context/modules/mkiv/s-xml-analyzers.mkiv
@@ -18,6 +18,7 @@
\installmodulecommandluasingle \showxmlstructure {moduledata.xml.analyzers.structure}
\installmodulecommandluasingle \showxmlcharacters {moduledata.xml.analyzers.characters}
\installmodulecommandluasingle \showxmlentities {moduledata.xml.analyzers.entities}
+\installmodulecommandluasingle \showxmlallsetups {moduledata.xml.analyzers.allsetups}
\stopmodule
@@ -33,6 +34,9 @@
\starttext
- \showxmlcharacters[\FileName]
+ \showxmlstructure [\FileName] \page
+ \showxmlentities [\FileName] \page
+ \showxmlcharacters[\FileName] \page
+ \showxmlallsetups [\FileName] \page
\stoptext
diff --git a/tex/context/modules/mkiv/x-asciimath.lua b/tex/context/modules/mkiv/x-asciimath.lua
index e0a4a714b..677d3519b 100644
--- a/tex/context/modules/mkiv/x-asciimath.lua
+++ b/tex/context/modules/mkiv/x-asciimath.lua
@@ -295,8 +295,8 @@ local reserved = {
["sigma"] = { true, "σ" },
["tau"] = { true, "τ" },
["upsilon"] = { true, "υ" },
- ["phi"] = { true, "φ" },
- ["varphi"] = { true, "ϕ" },
+ ["phi"] = { true, "ϕ" },
+ ["varphi"] = { true, "φ" },
["chi"] = { true, "χ" },
["psi"] = { true, "ψ" },
["omega"] = { true, "ω" },
@@ -1274,6 +1274,15 @@ local function collapse_bars(t)
i = i + 1
end
if l then
+ -- problem: we can have a proper nesting
+local d = false
+for i=1,m do
+ if find(t[i],"\\left") then
+ d = true
+ break
+ end
+end
+if not d then
local tt = { s_lnothing } -- space fools final checker
local tm = 1
for i=1,m do
@@ -1290,6 +1299,7 @@ local function collapse_bars(t)
tt[tm] = s_rnothing -- space fools final checker
m = tm
t = tt
+end
elseif m < n then
for i=n,m+1,-1 do
t[i] = nil
@@ -1739,7 +1749,7 @@ collapse = function(t,level)
-- steps
t = collapse_matrices (t) if trace_detail then show_state(t,level,"matrices") end
t = collapse_bars (t) if trace_detail then show_state(t,level,"bars") end
-t = collapse_stupids (t) if trace_detail then show_state(t,level,"stupids") end
+ t = collapse_stupids (t) if trace_detail then show_state(t,level,"stupids") end
t = collapse_pairs (t) if trace_detail then show_state(t,level,"pairs") end
t = collapse_parentheses(t) if trace_detail then show_state(t,level,"parentheses") end
t = collapse_signs (t) if trace_detail then show_state(t,level,"signs") end
diff --git a/tex/context/modules/mkiv/x-asciimath.mkiv b/tex/context/modules/mkiv/x-asciimath.mkiv
index d3a629c81..5c96d4f8a 100644
--- a/tex/context/modules/mkiv/x-asciimath.mkiv
+++ b/tex/context/modules/mkiv/x-asciimath.mkiv
@@ -299,7 +299,7 @@
%D This will become an extra.
-\showframe
+\starttext
\setups[asciimath:layout]
@@ -312,10 +312,12 @@
% % \ShowAsciiMathSave[e:/temporary/asciimath/asciimath.lua]
% \stoptext
-\starttext
-\unexpanded\def\MyAsciiMath#1{\startformula\asciimath{#1}\stopformula}
-\startlines
-\MyAsciiMath{x^2 / 10 // z_12^34 / 20}
+\subject{Some tests}
+
+% \unexpanded\def\MyAsciiMath#1{\startformula\asciimath{#1}\stopformula}
+%
+% \startlines
+% \MyAsciiMath{x^2 / 10 // z_12^34 / 20}
% \MyAsciiMath{{:{:x^2:} / 10:} // {:{:z_12^34 :} / 20:}}
% \MyAsciiMath{x^2+y_1+z_12^34}
% \MyAsciiMath{sin^-1(x)}
@@ -399,38 +401,82 @@
% \MyAsciiMath{x^ (-1 1/2) =1/x^ (1 1/2)=1/ (x^1*x^ (1/2)) =1/ (xsqrt(x))}
% \MyAsciiMath{x^2(10 -x)&gt;2 x^2}
% \MyAsciiMath{x^4&gt;x}
-\stoplines
-
-\setupasciimath[splitmethod=3,symbol={{,}}]
-
-\startlines
-\asciimath{sqrt 1}
-\asciimath{sqrt 1.2}
-\asciimath{sqrt 1.2}
-\asciimath{1}
-\asciimath{12}
-\asciimath{123}
-\asciimath{1234}
-\asciimath{12345}
-\asciimath{123456}
-\asciimath{1234567}
-\asciimath{12345678}
-\asciimath{123456789}
-\asciimath{1.1}
-\asciimath{12.12}
-\asciimath{1234.123}
-\asciimath{1234.1234}
-\asciimath{12345.1234}
-\asciimath{1234.12345}
-\asciimath{12345.12345}
-\asciimath{123456.123456}
-\asciimath{1234567.1234567}
-\asciimath{12345678.12345678}
-\asciimath{123456789.123456789}
-\asciimath{0.1234}
-\asciimath{1234.0}
-\asciimath{1234.00}
-\asciimath{0.123456789}
-\stoplines
+% \stoplines
+
+% \setupasciimath[splitmethod=3,symbol={{,}}]
+%
+% \startlines
+% \asciimath{sqrt 1}
+% \asciimath{sqrt 1.2}
+% \asciimath{sqrt 1.2}
+% \asciimath{1}
+% \asciimath{12}
+% \asciimath{123}
+% \asciimath{1234}
+% \asciimath{12345}
+% \asciimath{123456}
+% \asciimath{1234567}
+% \asciimath{12345678}
+% \asciimath{123456789}
+% \asciimath{1.1}
+% \asciimath{12.12}
+% \asciimath{1234.123}
+% \asciimath{1234.1234}
+% \asciimath{12345.1234}
+% \asciimath{1234.12345}
+% \asciimath{12345.12345}
+% \asciimath{123456.123456}
+% \asciimath{1234567.1234567}
+% \asciimath{12345678.12345678}
+% \asciimath{123456789.123456789}
+% \asciimath{0.1234}
+% \asciimath{1234.0}
+% \asciimath{1234.00}
+% \asciimath{0.123456789}
+% \stoplines
+
+% \definemixedcolumns[asciimath][n=3,balance=yes]
+%
+% \startluacode
+% local asciimath = moduledata.asciimath
+% local variables = { "w", "x", "y", "z", "p", "q", "r" }
+% local constants = { "a", "b", "c" }
+% local functions = { "g", "h", "i" }
+% local iterators = { "i", "j", "k" }
+% local vectors = { "A", "B", "C", "D", "E", "P", "Q", "R" }
+% local reserved = { }
+% local reserved = {
+% -- "vdots","ddots","oint",
+% "grad", "prod", "prop", "sube", "supe", "sum",
+% "vvv", "nnn", "uuu", "sub", "sup",
+% "iff", "int", "del",
+% "sinh", "cosh", "tanh", "sin", "cos", "tan", "csc", "sec", "cot",
+% "atan", "asin", "acos", "arctan", "arcsin", "arccos",
+% "log", "ln", "det", "lim", "mod", "gcd", -- "lcm",
+% "min", "max",
+% "xx", "in", "ox", "vv", "nn", "uu", "oo", "bb",
+% "not", "and", "or", "if",
+% "AA", "EE", "TT",
+% "sqrt", "root", "frac", "stackrel",
+% "hat", "overbar", "underline", "vec",
+% "dx", "dy", "dz",
+% }
+% for c=1,#constants do
+% for r=1,#reserved do
+% context.startmixedcolumns { "asciimath" }
+% for v1=1,#variables do
+% for v2=1,#variables do
+% local str = constants[c] .. variables[v1] .. reserved[r] .. variables[v2]
+% context.type(str)
+% context.quad()
+% commands.asciimath(str)
+% context.par()
+% end
+% end
+% context.stopmixedcolumns()
+% context.blank()
+% end
+% end
+% \stopluacode
\stoptext
diff --git a/tex/context/modules/mkiv/x-html.mkiv b/tex/context/modules/mkiv/x-html.mkiv
index e1806eb9e..723872dfd 100644
--- a/tex/context/modules/mkiv/x-html.mkiv
+++ b/tex/context/modules/mkiv/x-html.mkiv
@@ -148,9 +148,11 @@
%
% we can also use \xmlmap for border etc
+% \registerctxluafile{lxml-css}{1.001}
+
\starttexdefinition cssgetsinglepadding #1
\ctxlua {
- context((moduledata.css.padding(
+ context((xml.css.padding(
"#1",
\number\dimexpr0.1ex,
\number\dimexpr0.01\hsize,
diff --git a/tex/context/modules/mkiv/x-math-svg.mkvi b/tex/context/modules/mkiv/x-math-svg.mkvi
new file mode 100644
index 000000000..4645f75d8
--- /dev/null
+++ b/tex/context/modules/mkiv/x-math-svg.mkvi
@@ -0,0 +1,65 @@
+%D \module
+%D [ file=x-math-svg,
+%D version=2014.09.19,
+%D title=\CONTEXT\ XML Modules,
+%D subtitle=\MATHML\ to \SVG,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+\writestatus{loading}{ConTeXt XML Macros / MathML to SVG Converter}
+
+\usemodule[x][mathml]
+
+\registerctxluafile{x-math-svg}{}
+
+\starttexdefinition MakeSVGMath #index#page#mode
+ \setbox\scratchbox\hbox\bgroup
+ \xmlprocessbuffer{main}{math-#page}{}
+ \egroup
+ \ctxlua {
+ moduledata.svgmath.register(#index, #page, {
+ mode = "#mode",
+ width = \number\wd\scratchbox,
+ height = \number\ht\scratchbox,
+ depth = \number\dp\scratchbox,
+ } )
+ }
+ \startTEXpage
+ \box\scratchbox
+ \stopTEXpage
+\stoptexdefinition
+
+\starttexdefinition ReuseSVGMath #index#page
+ \ctxlua {
+ moduledata.svgmath.register(#index,#page)
+ }
+\stoptexdefinition
+
+% assume the same font .. what to do with size
+
+\startluacode
+
+ local svgstyle = document.arguments.svgstyle or ""
+
+ if type(svgstyle) == "string" and svgstyle ~= "" then
+ context.environment { svgstyle }
+ else
+ context.setupbodyfont { "pagella" }
+ end
+
+\stopluacode
+
+% \continueifinputfile{x-math-svg.mkvi}
+
+\starttext
+
+ \startluacode
+ moduledata.svgmath.process(environment.arguments.inputfile)
+ \stopluacode
+
+\stoptext
diff --git a/tex/context/modules/mkiv/x-mathml.lua b/tex/context/modules/mkiv/x-mathml.lua
index 7d0b42d21..9650afab8 100644
--- a/tex/context/modules/mkiv/x-mathml.lua
+++ b/tex/context/modules/mkiv/x-mathml.lua
@@ -187,6 +187,7 @@ local i_replacements = {
["true"] = "{\\mathrm true}",
["declare"] = "{\\mathrm declare}",
["as"] = "{\\mathrm as}",
+
}
-- we could use a metatable or when accessing fallback on the
diff --git a/tex/context/modules/mkiv/x-mathml.mkiv b/tex/context/modules/mkiv/x-mathml.mkiv
index a5be5ddb0..50d31da0e 100644
--- a/tex/context/modules/mkiv/x-mathml.mkiv
+++ b/tex/context/modules/mkiv/x-mathml.mkiv
@@ -1,6 +1,6 @@
%D \module
%D [ file=x-mathml,
-%D version=2008.05.29,
+%D version=2008.05.29, (evolved from pre 2000 code)
%D title=\CONTEXT\ XML Modules,
%D subtitle=\MATHML,
%D author=Hans Hagen,
@@ -13,20 +13,14 @@
% \xmlfilter{#1}{/*/name()} -> \xmltag
-% This module is under construction and will be cleaned up. We use a funny mix of
-% xml, tex and lua. I could rewrite the lot but it also shows how context evolves.
+% This implementation looks like a hack ... this is because we deal with all weird
+% cases we ran into, including abuse that was supposed to render ok (even if it
+% didn't in other renderers) .. it was simply expected to work that way.
%
-% I might end up with a lua-only implementation some day. I must find a good reason
-% to spend time on it. In fact, it might even be more messy.
-%
-% no m:text strip (needs checking, maybe nbsp is mandate
-%
-% todo: more will be moved to lua (less hassle)
-% todo: move left/right to the lua end
-%
-% this implememation looks like a hack ... this is because we deal with all weird cases we
-% ran into, including abuse that was supposed to render ok (even if it didn't in other
-% renderers) .. it was simply expected to work that way.
+% So, consider this module to be under constant construction and clean up. We still
+% use a funny mix of xml, tex and lua. I could rewrite the lot but it also shows how
+% context evolves. I might end up with a lua-only implementation some day, but I must
+% find a real good reason to spend time on it as so far it never paid back.
\writestatus{loading}{ConTeXt XML Macros / MathML Renderer}
@@ -210,7 +204,7 @@
%D The second implementation expanded the whole math sequence
%D into an internal \TEX\ representation. This is a rather clean
%D and fast process. Filtering and testing takes place by
-%D redefining teh internal representation macros.
+%D redefining the internal representation macros.
%D
%D The third implementation may look a bit more messy in some
%D respects. This is because in \TEX\ it's not that trivial to
@@ -1855,9 +1849,13 @@
\let\mmlfrac\frac
\xmlmapvalue {mml:l} {+} {\let\mmlfrac\sfrac}
+\xmlmapvalue {mml:d} {true} {\displaystyle}
+\xmlmapvalue {mml:d} {false} {\textstyle} % or whatever
+
% todo: displaystyle=true/false (or whatever else shows up)
\starttexdefinition setmmlmathstyle #1
+ \xmlval{mml:d}{\xmlatt{#1}{displaystyle}}\empty % was: \mmmr
\xmlval{mml:s}{\xmlatt{#1}{mathvariant}}\empty % was: \mmmr
\stoptexdefinition
@@ -2042,7 +2040,11 @@
\expanded{\doifelseinset {mml:enclose:radical} {\mmlmenclosenotation}} {
\sqrt{\xmlflush{#1}}
} {
- \xmlflush{#1}
+ \expanded{\doifelseinset {mml:enclose:rule} {\mmlmenclosenotation}} {
+ \overline{\strut\xmlflush{#1}}
+ } {
+ \xmlflush{#1}
+ }
}
}
}
@@ -2270,9 +2272,9 @@
\def\mmlextensible#1{\ctxmodulemathml{extensible(\!!bs#1\!!es)}}
-\definemathtriplet [\v!mathematics] [mmlovertriplet] % or will we use a special instance
-\definemathtriplet [\v!mathematics] [mmlundertriplet] % or will we use a special instance
-\definemathtriplet [\v!mathematics] [mmldoubletriplet] % or will we use a special instance
+\definemathtriplet [\v!mathematics] [mmlovertriplet] % or will we use a special instance
+\definemathtriplet [\v!mathematics] [mmlundertriplet] % or will we use a special instance
+\definemathtriplet [\v!mathematics] [mmldoubletriplet] % or will we use a special instance
% common to munder/mover/munderover : will become core helper (speed up too)
@@ -2321,9 +2323,15 @@
\startxmlsetups mml:mover
\edef\mmlbasetoken{\mmlextensible{\xmlraw{#1}{/mml:*[1]}}}% /text()
- \doifelseutfmathfiller\mmlbasetoken \mmloverbasefiller \mmloveraccentchecker {#1}
+ \doifelseutfmathlimop\mmlbasetoken
+ {\mmllimopover{#1}}
+ {\doifelseutfmathfiller\mmlbasetoken \mmloverbasefiller \mmloveraccentchecker {#1}}
\stopxmlsetups
+\starttexdefinition mmllimopover #1
+ \mmlbasetoken ^{\mmlfencedsecond{#1}}
+\stoptexdefinition
+
% munder
\starttexdefinition unexpanded mmlunderbelow #1
@@ -2353,9 +2361,15 @@
\startxmlsetups mml:munder
\edef\mmlbasetoken{\mmlextensible{\xmlraw{#1}{/mml:*[1]}}}% /text()
- \doifelseutfmathfiller\mmlbasetoken \mmlunderbasefiller \mmlunderaccentchecker {#1}
+ \doifelseutfmathlimop\mmlbasetoken
+ {\mmllimopunder{#1}}
+ {\doifelseutfmathfiller\mmlbasetoken \mmlunderbasefiller \mmlunderaccentchecker {#1}}
\stopxmlsetups
+\starttexdefinition mmllimopunder #1
+ \mmlbasetoken _{\mmlfencedsecond{#1}}
+\stoptexdefinition
+
% munderover
\starttexdefinition unexpanded mmlunderoveraccentcheckerUO #1
@@ -2414,11 +2428,18 @@
\edef\mmlbasecommand{e\utfmathcommandfiller\mmlbasetoken}%
\mmlexecuteifdefined\mmlbasecommand \relax {\mmlfencedthird{#1}} {\mmlfencedsecond{#1}}
\stoptexdefinition
+
\startxmlsetups mml:munderover
\edef\mmlbasetoken{\mmlextensible{\xmlraw{#1}{/mml:*[1]}}}% /text()
- \doifelseutfmathfiller\mmlbasetoken \mmlunderoverbasefiller \mmlunderoveraccentchecker {#1}
+ \doifelseutfmathlimop\mmlbasetoken
+ {\mmllimopunderover{#1}}
+ {\doifelseutfmathfiller\mmlbasetoken \mmlunderoverbasefiller \mmlunderoveraccentchecker {#1}}
\stopxmlsetups
+\starttexdefinition mmllimopunderover #1
+ \mmlbasetoken ^{\mmlfencedthird{#1}}_{\mmlfencedsecond{#1}}
+\stoptexdefinition
+
% tables (mml:mtable, mml:mtr, mml:mlabledtr, mml:mtd)
\startxmlsetups mml:mtable % some more attributes need to be supported
@@ -2430,7 +2451,7 @@
\stopxmlsetups
\startxmlsetups mml:mcolumn
- \ctxmodulemathml{mcolumn("#1")}
+ \vbox{\ctxmodulemathml{mcolumn("#1")}}% needs checking
\stopxmlsetups
\def\mmlsetfakewidth#1{\setbox\scratchbox\hbox{#1}\scratchdimen\wd\scratchbox}
diff --git a/tex/context/modules/mkiv/x-setups-basics.mkiv b/tex/context/modules/mkiv/x-setups-basics.mkiv
index 4a7859c7f..1c0eb8346 100644
--- a/tex/context/modules/mkiv/x-setups-basics.mkiv
+++ b/tex/context/modules/mkiv/x-setups-basics.mkiv
@@ -25,6 +25,8 @@
%D Currently we load the \XML\ file and when not in the english interface we just
%D remap the relevant words to their translation.
+%D Todo: use lua instead of synonyms
+
\unprotect
\defineregister
@@ -45,7 +47,7 @@
[\c!width=\hsize,
\c!height=\v!fit,
\c!align=\v!right,
- \c!offset=0.75\emwidth]
+ \c!offset=0.75\emwidth] % \exheight
\popmacro\setuptext
@@ -69,7 +71,8 @@
\unexpanded\def\setupalwcolor{}
\unexpanded\def\setupoptcolor{darkgray}
-\unexpanded\def\setupvarword#1{{\sl\detokenize{#1}}}
+% \unexpanded\def\setupvarword#1{{\sl\detokenize{#1}}}
+\unexpanded\def\setupvarword#1{\detokenize{#1}}
\unexpanded\def\setupintword#1{\WORD{\detokenize{#1}}}
\unexpanded\def\setuptxtword#1{\detokenize{#1}}
@@ -119,16 +122,68 @@
}
\stopxmlsetups
+\startxmlsetups xml:setups:assemblename:instance
+ \doifelse {\xmlatt{#1}{type}} {environment} {
+ \doifsomethingelse {\xmlatt{#1}{begin}} {
+ \edef\currentSETUPprefix{\xmllastatt}%
+ } {
+ \let\currentSETUPprefix\e!start
+ }
+ } {
+ \let\currentSETUPprefix\empty
+ }
+% \edef\currentSETUPname{\xmlatt{#1}{name}}
+ \let\currentSETUPgenerated\empty
+ \doifelsenothing {\xmlatt{#1}{variant}} {
+ \let\currentSETUPvariant\empty
+ } {
+ \def\currentSETUPvariant{:\xmllastatt}
+ }
+ \edef\currentSETUPfullname {
+ \currentSETUPprefix
+ \currentSETUPname
+ \currentSETUPvariant
+ \currentSETUPgenerated
+ }
+\stopxmlsetups
+
+% \startxmlsetups xml:setups:register
+% \doifelse {\xmlatt{#1}{variant}} {instance} {
+% \def\docommand##1%
+% {\def\currentSETUPname{##1}%
+% \xmlsetup{#1}{xml:setups:assemblename:instance}
+% \expanded{\texcommand[stp:x:\currentSETUPfullname]{{#1}{##1}}}}%
+% \processcommacommand[\clf_getinstances{#1}]\docommand
+% } {
+% \xmlsetup{#1}{xml:setups:assemblename}
+% % not really needed if we just use setups
+% \expanded{\texcommand[stp:x:\currentSETUPfullname]{{#1}{}}}
+% }
+% \stopxmlsetups
+
\startxmlsetups xml:setups:register
+ \doif {\xmlatt{#1}{variant}} {instance} {
+ \def\docommand##1%
+ {\xmlsetup{#1}{xml:setups:assemblename:instance}
+ \expanded{\texcommand[stp:x:\currentSETUPfullname:##1]{{#1}{##1}}}}%
+ \processcommacommand[\clf_getinstances{#1}]\docommand
+ }
\xmlsetup{#1}{xml:setups:assemblename}
% not really needed if we just use setups
- \expanded{\texcommand[stp:x:\currentSETUPfullname]{#1}}
+ \expanded{\texcommand[stp:x:\currentSETUPfullname]{{#1}{}}}
\stopxmlsetups
\startluacode
local find, gsub = string.find, string.gsub
+ local xmlcollected = xml.collected
+ local xmlcount = xml.count
+ local xmlfirst = xml.first
+
+ local lxmlgetid = lxml.getid
+ local lxmlflush = lxml.flush
+
local context = context
local setupvarword = context.formatted.setupvarword
@@ -146,12 +201,11 @@
setups.definitions = definitions
function xml.functions.setups_define(id)
- local x = lxml.getid(id)
- for c in xml.collected(x,"cd:interface/cd:define") do
+ local x = lxmlgetid(id)
+ for c in xmlcollected(x,"cd:interface/cd:define") do
definitions[c.at.name] = c
end
-
- for c in xml.collected(x,"cd:interface/cd:interface") do
+ for c in xmlcollected(x,"cd:interface/cd:interface") do
c.at.file = c.__f__
c.at["xmlns:cd"] = nil
-- c.dt[#c.dt+1] = " "
@@ -166,22 +220,23 @@
local commands = interfaces.complete.commands
local elements = interfaces.complete.elements
- local function replace(pattern,attribute,one,two)
- for e in xml.collected(x,pattern) do
- local t = e.at[attribute]
+ local function replace(pattern,attribute,one,two,three)
+ for e in xmlcollected(x,pattern) do
+ local a = e.at
+ local t = a[attribute]
if t then
- local c = one[t] or (two and two[t])
+ local c = one[t] or (two and two[t]) or (three and three[t])
if c then
local v = c[interface]
if v then
- e.at[attribute] = v
+ a[attribute] = v
end
end
end
end
end
- replace('cd:command', 'name', commands, elements)
+ replace('cd:command', 'name', commands, elements, variables)
replace('cd:string', 'value', commands, elements)
replace('cd:variable' , 'value', variables)
@@ -191,19 +246,74 @@
replace('cd:variable', 'type', variables)
replace('cd:inherit', 'name', commands, elements)
+ replace('cd:instances/cd:constant', 'value', variables)
end
if tex.modes["setups:save"] and environment.currentrun == 1 then
- local s = tostring(x)
- s = gsub(s,"\n*%s*(</cd:interface>)%s+(<cd:interface)", "\n\n %1\n\n %2")
- s = gsub(s,"\n*%s*(</cd:interface>)%s+(</cd:interface>)","\n\n %1\n\n %2")
- io.savedata("context-"..interface..".xml",s)
+ --
+ -- the reload is a hack .. we could make a handler instead
+ --
+ local filename = "context-" .. interface .. ".xml"
+ local xmlroot = x
+ local xmlblob = tostring(xmlroot)
+ io.savedata(filename,xmlblob)
+ xmlroot = xml.load(filename)
+ --
+ local definitions = { }
+ for e in xml.collected(xmlroot,"cd:interface/cd:define") do
+ definitions[e.at.name] = e.dt
+ end
+ local function resolve(root)
+ for e in xmlcollected(root,"*") do
+ if e.tg == "resolve" then
+ local name = e.at.name or ""
+ local resolved = definitions[name]
+ if resolved then
+ e.__p__.dt[e.ni] = resolved
+ resolve(resolved)
+ -- logs.report("setups","resolved: %a",name)
+ else
+ logs.report("setups","unable to resolve: %a",name)
+ end
+ end
+ end
+ end
+ resolve(xmlroot)
+ for e in xml.collected(xmlroot,"cd:interface/cd:define") do
+ e.__p__.dt[e.ni] = ""
+ end
+ xml.delete(xmlroot,"/cd:interface/cd:interface/cd:interface/..")
+ --
+ xmlblob = xml.tostring(xmlroot)
+ io.savedata(filename,xmlblob)
+ xmlroot = xml.load(filename)
+ --
+ local spacer = utilities.strings.newrepeater(" ")
+ local function simplify(dt,n)
+ local nt, nn = { }, 0
+ for i=1,#dt do
+ local d = dt[i]
+ if d.special then
+ --
+ elseif type(d) ~= "string" then
+ d.dt = simplify(d.dt,n+1)
+ nn = nn + 1 nt[nn] = "\n" .. spacer[n]
+ nn = nn + 1 nt[nn] = d
+ nn = nn + 1 nt[nn] = "\n" .. spacer[n-1]
+ end
+ end
+ return nn == 0 and "" or nt
+ end
+ xmlroot.dt = simplify(xmlroot.dt,0)
+ --
+ xmlblob = "<?xml version='1.0'?>\n<!-- expanded and compacted i-context.xml -->\n" .. xml.tostring(xmlroot)
+ xmlblob = gsub(xmlblob,"\n *\n","\n")
+ io.savedata(filename,xmlblob)
end
-
end
function moduledata.setups.resolved(name)
- lxml.flush(definitions[name])
+ lxmlflush(definitions[name])
end
function xml.finalizers.s_count(collected)
@@ -213,7 +323,7 @@
local tg = c.tg
if tg == "resolve" then
local d = definitions[c.at.name]
- n = n + xml.count(d,"/*")
+ n = n + xmlcount(d,"/*")
elseif tg == "delimiter" then
-- skip
else
@@ -223,13 +333,30 @@
context(n)
end
+ local function getinstances(id)
+ local t = { }
+ local x = lxmlgetid(id)
+ local r = xmlfirst(x,"/instances/resolve")
+ if r then
+ local x = setups.definitions[r.at.name]
+ for c in xmlcollected(x,"constant") do
+ t[#t+1] = c.at.value
+ end
+ else
+ for c in xmlcollected(x,"/instances/constant") do
+ t[#t+1] = c.at.value
+ end
+ end
+ return t
+ end
+
interfaces.implement {
name = "getsetupstring",
actions = function(s)
local g = getsetupstring(s)
if not find(s,"^cd:") then
setuptxtword(g)
- elseif find(s,"%-.$") then
+ elseif find(s,"%-.$") then -- singular | plural
setupvarword(g)
else
setupintword(g) -- cap
@@ -246,6 +373,12 @@
arguments = "string",
}
+ interfaces.implement {
+ name = "getinstances",
+ actions = { getinstances, function(t) context("%,t",t) end },
+ overload = true,
+ arguments = { "string" },
+ }
\stopluacode
% <?xml version="1.0" encoding="UTF-8"?>
@@ -297,13 +430,20 @@
\let \m_cmd_current_hash \empty
\let \m_cmd_current_file \empty
+% todo: use different names (and a backward compatible extra module then)
+
\unexpanded\def\basicsetup{\c_cmd_kind\zerocount\cmd_show_setup}
\unexpanded\def\shortsetup{\c_cmd_kind\plusone \cmd_show_setup}
\unexpanded\def\setup {\c_cmd_kind\plustwo \cmd_show_setup}
\unexpanded\def\showsetup {\c_cmd_kind\plustwo \cmd_show_setup}
\unexpanded\def\showsetupinlist#1#2#3%
- {\c_cmd_kind\plustwo\xmlsetup{#3}{xml:setups:typeset}\par}
+ {%(#1)(#2)(#3)\par
+ \edef\m_cmd_instance{\secondoftwoarguments#3}%
+ \c_cmd_kind\plustwo
+ \xmlsetup{\firstoftwoarguments#3}{xml:setups:typeset}
+ \let\m_cmd_instance\empty
+ \par}
\installtextracker
{cmd.showsetup}
@@ -327,7 +467,12 @@
\fi
\startelement[setup][name=#1]%
\startelement[noexport][comment={setup definition #1}]%
- \xmlsetup{\rawsynonymname{texcommand}{stp:x:#1}}{xml:setups:typeset}
+ \edef\cmd_id{\rawsynonymname{texcommand}{stp:x:#1}}%
+ \ifx\cmd_id\empty
+ missing: stp:x:#1
+ \else
+ \xmlsetup{\expandafter\firstoftwoarguments\cmd_id}{xml:setups:typeset}
+ \fi
\stopelement
\stopelement}
@@ -358,8 +503,16 @@
\xmlatt{#1}{value}
\stopxmlsetups
+\startxmlsetups xml:setups:make:instance
+ \ifx\m_cmd_instance\empty
+ \setupintfont{\xmlatt{#1}{value}}
+ \else
+ \m_cmd_instance
+ \fi
+\stopxmlsetups
+
\startxmlsetups xml:setups:make:variable
- \xmlatt{#1}{value}
+ \setupintfont{\xmlatt{#1}{value}}
\stopxmlsetups
\let\m_cmd_current_hash\empty
@@ -368,6 +521,7 @@
\let\m_cmd_name \empty
\let\m_cmd_start \empty
\let\m_cmd_stop \empty
+\let\m_cmd_instance \empty
\startxmlsetups xml:setups:make:prepare
\edef\m_cmd_current_hash{\xmlatt{#1}{hash}}
@@ -375,7 +529,7 @@
\xmldoifelseempty{#1}{/sequence} {
\edef\m_cmd_name{\xmlatt{#1}{name}}
} {
- \edef\m_cmd_name{\xmlfilter{#1}{/sequence/(string|variable)/command(xml:setups:make:*)}}
+ \edef\m_cmd_name{\xmlfilter{#1}{/sequence/(string|variable|instance)/command(xml:setups:make:*)}}
}
\doifelse {\xmlatt{#1}{type}} {environment} {
\doifsomethingelse {\xmlatt{#1}{begin}} {
@@ -474,17 +628,23 @@
\stopxmlsetups
\startxmlsetups xml:setups:instance
- \xmlatt{#1}{value}\enspace
+ \doifelse {\xmltag{#1}} {resolve} {
+ \ctxlua{lxml.command(moduledata.setups.definitions['\xmlatt{#1}{name}'],"constant","xml:setups:instance")}
+ } {
+ \xmlatt{#1}{value}\enskip % we need a break
+ }
\stopxmlsetups
\startxmlsetups xml:setups:typeset:instances
- \xmldoif{#1}{/instances} {
- \godown[.75\lineheight]
- {\ttbf instances:}
- \enspace
- \xmlfilter{#1}{/instances/constant/command(xml:setups:instance)}
- \removeunwantedspaces
- }
+ \ifx\m_cmd_instance\empty
+ \xmldoif{#1}{/instances} {
+ \godown[.75\lineheight]
+ {\ttbf instances:}
+ \enspace
+ \xmlfilter{#1}{/instances/(constant|resolve)/command(xml:setups:instance)}
+ \removeunwantedspaces
+ }
+ \fi
\stopxmlsetups
\startxmlsetups xml:setups:typeset:yes
@@ -742,26 +902,35 @@
\unexpanded\def\show_setup_any#1#2%
{\bgroup
\global\advance\c_cmd_current_argument\plusone
+ \doifelse{\xmlatt{#1}{optional}}{yes}\donetrue\donefalse
\setbox0=\hbox
- {\doifelse{\xmlatt{#1}{list}}{yes}
+ {\ifdone\sl\fi
+ \doifelse{\xmlatt{#1}{list}}{yes}
{\getsetupstring{cd:#2-l}}%
{\getsetupstring{cd:#2-s}}}%
\setbox2=\hbox to \wd0
{\hss
- \raise1.25\exheight\hbox
- {\txx\ifcase\c_cmd_maximum_argument \relax
- \or*\else\the\c_cmd_current_argument
- \fi}%
+ \ifcase\c_cmd_kind\else
+ \ifcase\c_cmd_maximum_argument \relax
+ \or
+ \raise1.25\exheight\hbox
+ {\txx *}%
+ \else
+ \raise1.25\exheight\hbox
+ {\txx\the\c_cmd_current_argument}%
+ \fi
+ \fi
\hss}%
\setbox4=\hbox to \wd0
{\hss
- \lower2\exheight\hbox
- \bgroup
- \txx
- \doif {\xmlatt{#1}{optional}} {yes}
- {\getsetupstring{cd:optional}}%
- \egroup
- \hss}%
+ \ifdone
+ \lower2\exheight\hbox
+ \bgroup
+ \txx
+ \getsetupstring{cd:optional}%
+ \egroup
+ \hss
+ \fi}%
\ht2\ht\strutbox
\dp4\dp\strutbox
\hskip.5\emwidth
@@ -871,9 +1040,10 @@
}
\blank[\v!big,\v!samepage]
\starttabulate[|l|p|]
+ % no /interface here
\xmlall
{#1}
- {/interface/command[@name=='\currentsetupparametercommand' or @handler=='\currentsetupparametercommand']/arguments/assignments/parameter/command(xml:setups:parameters:value)}
+ {interface/command[@name=='\currentsetupparametercommand' or @handler=='\currentsetupparametercommand']/arguments/assignments/parameter/command(xml:setups:parameters:value)}
\ifnum\noftabulaterows = \zerocount
\NC \parameterkey{no specific settings} \NC \NC \NR
\fi
@@ -903,6 +1073,15 @@
\let\cmdshortsetup\shortsetup
\let\cmdfullsetup \showsetup
+\unexpanded\def\cmd_with_instance#1#2#3%
+ {\edef\m_cmd_instance{#3}%
+ #1{#2}%
+ \let\m_cmd_instance\empty}
+
+\unexpanded\def\cmdbasicsetupinstance{\cmd_with_instance\cmdbasicsetup}
+\unexpanded\def\cmdshortsetupinstance{\cmd_with_instance\cmdshortsetup}
+\unexpanded\def\cmdfullsetupinstance {\cmd_with_instance\cmdfullsetup }
+
% bonus
\definefloat
@@ -912,7 +1091,13 @@
[definition]
[align=flushright]
-\unexpanded\def\showdefinition#1%
+\unexpanded\def\showdefinition
+ {\doifelsenextoptional\cmd_show_definition_yes\cmd_show_definition_nop}
+
+\unexpanded\def\cmd_show_definition_nop#1%
+ {\cmd_show_definition_yes[#1]}
+
+\unexpanded\def\cmd_show_definition_yes[#1]%
{\placedefinition[here][definition:#1]{\tex{#1}}{\showsetup{#1}}}
\unexpanded\def\definition[#1]%
diff --git a/tex/context/modules/mkiv/x-setups-overview.mkiv b/tex/context/modules/mkiv/x-setups-overview.mkiv
index 8cfe14439..c0047f13a 100644
--- a/tex/context/modules/mkiv/x-setups-overview.mkiv
+++ b/tex/context/modules/mkiv/x-setups-overview.mkiv
@@ -14,6 +14,8 @@
% context --interface=en --global --result=setup-en x-setups-overview.mkiv
+% \enablemode[setups:save]
+
\usemodule[setups-basics]
\unprotect
diff --git a/tex/context/modules/mkiv/x-setups-proofing.mkiv b/tex/context/modules/mkiv/x-setups-proofing.mkiv
index e40ee2ad1..5583b8861 100644
--- a/tex/context/modules/mkiv/x-setups-proofing.mkiv
+++ b/tex/context/modules/mkiv/x-setups-proofing.mkiv
@@ -17,9 +17,6 @@
\unprotect
-\loadsetups
- [\jobname.xml]
-
\setupbodyfont
[10pt]
@@ -45,6 +42,8 @@
\loadsetups[i-common-definitions]
+ \loadsetups[\jobname.xml]
+
\placeeverysetup
\stoptext
diff --git a/tex/context/modules/mkiv/x-steps.mkiv b/tex/context/modules/mkiv/x-steps.mkiv
index 29b3f7eaa..02b4cda77 100644
--- a/tex/context/modules/mkiv/x-steps.mkiv
+++ b/tex/context/modules/mkiv/x-steps.mkiv
@@ -18,6 +18,8 @@
\usemodule[m][steps]
+\endinput
+
\unprotect
\installcorenamespace {xmlstepchart}
@@ -46,40 +48,40 @@
\xmlregistersetup{xml:ct:define}
-\startxmlsetups xml:ct:prep
- \expanded{\prep[\xmltoparameters{#1}]}{\xmlflush{#1}}
-\stopxmlsetups
+% \startxmlsetups xml:ct:prep
+% \normalexpanded{\prep[\xmltoparameters{#1}]}{\xmlflush{#1}}
+% \stopxmlsetups
\startxmlsetups xml:ct:text
- \expanded{\text[\xmltoparameters{#1}]}{\xmlflush{#1}}
+ \normalexpanded{\text[\xmltoparameters{#1}]}{\xmlflush{#1}}
\stopxmlsetups
\startxmlsetups xml:ct:texts
- \expanded{\texts[\xmltoparameters{#1}]}{\xmltext{#1}{/top}} {\xmltext{#1}{/bot}}
+ \normalexpanded{\texts[\xmltoparameters{#1}]}{\xmltext{#1}{/top}} {\xmltext{#1}{/bot}}
\stopxmlsetups
\startxmlsetups xml:ct:cell
- \expanded{\cell[\xmltoparameters{#1}]}{\xmlflush{#1}}
+ \normalexpanded{\cell[\xmltoparameters{#1}]}{\xmlflush{#1}}
\stopxmlsetups
\startxmlsetups xml:ct:cells
- \expanded{\cells[\xmltoparameters{#1}]}{\xmltext{#1}{/top}} {\xmltext{#1}{/bot}}
+ \normalexpanded{\cells[\xmltoparameters{#1}]}{\xmltext{#1}{/top}} {\xmltext{#1}{/bot}}
\stopxmlsetups
\startxmlsetups xml:ct:lines
- \expanded{\startlines[\xmltoparameters{#1}]}
+ \normalexpanded{\startlines[\xmltoparameters{#1}]}
\xmlflush{#1}
\stoplines
\stopxmlsetups
\startxmlsetups xml:ct:steptable
- \expanded{\startSTEPtable[\xmltoparameters{#1}]}
+ \normalexpanded{\startSTEPtable[\xmltoparameters{#1}]}
\xmlflush{#1}
\stopSTEPtable
\stopxmlsetups
\startxmlsetups xml:ct:stepchart
- \expanded{\startSTEPchart[\xmltoparameters{#1}]}
+ \normalexpanded{\startSTEPchart[\xmltoparameters{#1}]}
\xmlflush{#1}
\stopSTEPchart
\stopxmlsetups