From 974640d66e61e81cb197ad96fdff7b08343e4c5a Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sat, 6 Mar 2021 21:58:15 +0000 Subject: context git-svn-id: svn://tug.org/texlive/trunk@58167 c570f23f-e606-0410-a88d-b1316a301751 --- .../modules/common/s-abbreviations-logos.tex | 6 +- .../context/modules/common/s-obsolete-tokens.mkiv | 346 +++++++++++ .../tex/context/modules/mkiv/m-catchword.mkiv | 2 +- .../tex/context/modules/mkiv/m-chart.lua | 28 +- .../tex/context/modules/mkiv/m-chart.mkvi | 18 +- .../tex/context/modules/mkiv/m-educat.mkiv | 2 +- .../tex/context/modules/mkiv/m-examn.mkiv | 577 ++++++++++++++++++ .../tex/context/modules/mkiv/m-format.mkiv | 2 +- .../tex/context/modules/mkiv/m-gnuplot.mkxl | 97 +++ .../tex/context/modules/mkiv/m-ipsum.mkiv | 50 +- .../tex/context/modules/mkiv/m-morse.mkvi | 4 +- .../tex/context/modules/mkiv/m-nodechart.lua | 4 +- .../tex/context/modules/mkiv/m-ntb-to-xtb.mkiv | 6 +- .../tex/context/modules/mkiv/m-oldfun.mkiv | 6 +- .../tex/context/modules/mkiv/m-oldnum.mkiv | 12 +- .../tex/context/modules/mkiv/m-punk.mkiv | 5 + .../tex/context/modules/mkiv/m-scite.mkiv | 39 +- .../texmf-dist/tex/context/modules/mkiv/m-sql.mkiv | 4 +- .../tex/context/modules/mkiv/m-steps.lua | 2 +- .../tex/context/modules/mkiv/m-steps.mkvi | 40 +- .../context/modules/mkiv/m-system-aliasing.mkiv | 120 ++++ .../tex/context/modules/mkiv/m-system-readers.mkxl | 148 +++++ .../tex/context/modules/mkiv/m-tikz.mkiv | 75 +++ .../tex/context/modules/mkiv/m-timing.mkxl | 113 ++++ .../tex/context/modules/mkiv/m-visual.mkiv | 10 +- .../context/modules/mkiv/s-article-titlepage.mkiv | 2 +- .../tex/context/modules/mkiv/s-fonts-coverage.mkiv | 2 +- .../tex/context/modules/mkiv/s-fonts-shapes.mkiv | 4 +- .../tex/context/modules/mkiv/s-fonts-tables.lua | 12 +- .../tex/context/modules/mkiv/s-fonts-variable.mkiv | 16 + .../tex/context/modules/mkiv/s-inf-01.mkvi | 38 +- .../modules/mkiv/s-languages-hyphenation.lua | 25 +- .../tex/context/modules/mkiv/s-magazine-basic.mkiv | 7 +- .../tex/context/modules/mkiv/s-maps.mkiv | 7 +- .../tex/context/modules/mkiv/s-module-basic.mkiv | 45 +- .../tex/context/modules/mkiv/s-present-balls.mkiv | 2 +- .../tex/context/modules/mkiv/s-present-bars.mkiv | 6 +- .../tex/context/modules/mkiv/s-present-boring.mkiv | 143 +++++ .../context/modules/mkiv/s-present-colorful.mkiv | 2 +- .../tex/context/modules/mkiv/s-present-funny.mkiv | 2 +- .../tex/context/modules/mkiv/s-present-fuzzy.mkiv | 2 +- .../tex/context/modules/mkiv/s-present-green.mkiv | 2 +- .../context/modules/mkiv/s-present-organic.mkiv | 2 +- .../context/modules/mkiv/s-present-original.mkiv | 2 +- .../tex/context/modules/mkiv/s-present-split.mkiv | 2 +- .../tex/context/modules/mkiv/s-present-stack.mkiv | 2 +- .../context/modules/mkiv/s-present-stepper.mkiv | 2 +- .../tex/context/modules/mkiv/s-present-tiles.mkiv | 6 +- .../tex/context/modules/mkiv/s-present-weird.mkiv | 2 +- .../context/modules/mkiv/s-present-windows.mkiv | 2 +- .../context/modules/mkiv/s-references-show.mkiv | 2 +- .../tex/context/modules/mkiv/s-syntax.mkiv | 84 +-- .../tex/context/modules/mkiv/s-system-macros.mkxl | 311 ++++++++++ .../tex/context/modules/mkiv/s-system-tokens.mkxl | 84 +++ .../tex/context/modules/mkiv/s-system-visual.mkiv | 94 +++ .../context/modules/mkiv/s-tugboat-columns.mkiv | 16 +- .../tex/context/modules/mkiv/s-tugboat.mkiv | 6 +- .../tex/context/modules/mkiv/x-math-svg.lua | 6 +- .../tex/context/modules/mkiv/x-mathml-basics.mkiv | 12 +- .../tex/context/modules/mkiv/x-mathml.mkiv | 2 - .../tex/context/modules/mkiv/x-setups-basics.mkiv | 12 +- .../modules/mkxl/s-characters-combinations.lmt | 30 + .../modules/mkxl/s-characters-combinations.mkxl | 61 ++ .../tex/context/modules/mkxl/s-colors-show.mkxl | 276 +++++++++ .../tex/context/modules/mkxl/s-fonts-show.mkxl | 658 +++++++++++++++++++++ .../tex/context/modules/mkxl/s-layout-show.mkxl | 243 ++++++++ .../context/modules/mkxl/s-publications-show.mkxl | 84 +++ .../tex/context/modules/mkxl/s-symbols-show.mkxl | 110 ++++ 68 files changed, 3888 insertions(+), 256 deletions(-) create mode 100644 Master/texmf-dist/tex/context/modules/common/s-obsolete-tokens.mkiv create mode 100644 Master/texmf-dist/tex/context/modules/mkiv/m-examn.mkiv create mode 100644 Master/texmf-dist/tex/context/modules/mkiv/m-gnuplot.mkxl create mode 100644 Master/texmf-dist/tex/context/modules/mkiv/m-system-aliasing.mkiv create mode 100644 Master/texmf-dist/tex/context/modules/mkiv/m-system-readers.mkxl create mode 100644 Master/texmf-dist/tex/context/modules/mkiv/m-tikz.mkiv create mode 100644 Master/texmf-dist/tex/context/modules/mkiv/m-timing.mkxl create mode 100644 Master/texmf-dist/tex/context/modules/mkiv/s-present-boring.mkiv create mode 100644 Master/texmf-dist/tex/context/modules/mkiv/s-system-macros.mkxl create mode 100644 Master/texmf-dist/tex/context/modules/mkiv/s-system-tokens.mkxl create mode 100644 Master/texmf-dist/tex/context/modules/mkiv/s-system-visual.mkiv create mode 100644 Master/texmf-dist/tex/context/modules/mkxl/s-characters-combinations.lmt create mode 100644 Master/texmf-dist/tex/context/modules/mkxl/s-characters-combinations.mkxl create mode 100644 Master/texmf-dist/tex/context/modules/mkxl/s-colors-show.mkxl create mode 100644 Master/texmf-dist/tex/context/modules/mkxl/s-fonts-show.mkxl create mode 100644 Master/texmf-dist/tex/context/modules/mkxl/s-layout-show.mkxl create mode 100644 Master/texmf-dist/tex/context/modules/mkxl/s-publications-show.mkxl create mode 100644 Master/texmf-dist/tex/context/modules/mkxl/s-symbols-show.mkxl (limited to 'Master/texmf-dist/tex/context/modules') diff --git a/Master/texmf-dist/tex/context/modules/common/s-abbreviations-logos.tex b/Master/texmf-dist/tex/context/modules/common/s-abbreviations-logos.tex index 11c5b9725d2..dfac57f0af6 100644 --- a/Master/texmf-dist/tex/context/modules/common/s-abbreviations-logos.tex +++ b/Master/texmf-dist/tex/context/modules/common/s-abbreviations-logos.tex @@ -11,6 +11,8 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. +% avoid two character abbreviations + \startmodule[abbreviations-logos] \logo [MKI] {MkI} % joke @@ -27,7 +29,7 @@ \logo [MPVI] {MpVI} \logo [MPLX] {MpLX} \logo [MPXL] {MpXL} -\logo [LMTX] {lmtx} +\logo [LMTX] {LMTX} \logo [ACROBAT] {Acro\-bat} \logo [AFM] {afm} @@ -369,6 +371,6 @@ \logo [KB] {KB} \logo [MB] {MB} \logo [GB] {GB} -\logo [TB] {TB} +% \logo [TB] {TB} \stopmodule diff --git a/Master/texmf-dist/tex/context/modules/common/s-obsolete-tokens.mkiv b/Master/texmf-dist/tex/context/modules/common/s-obsolete-tokens.mkiv new file mode 100644 index 00000000000..0d055049c24 --- /dev/null +++ b/Master/texmf-dist/tex/context/modules/common/s-obsolete-tokens.mkiv @@ -0,0 +1,346 @@ +%D \module +%D [ file=toks-tra, % was toks-ini +%D version=2007.03.03, +%D title=\CONTEXT\ Obsolete Modules, +%D subtitle=Tokens, +%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 code here used to be in the \type {toks-tra} files which were made in +%D the real early days of \LUATEX\ and used in articles and presentations +%D about this engine. Because the code is used in manuals we keep it around +%D as module. + +\writestatus{loading}{ConTeXt Obsolete Modules / Tokens} + +%D This used to be in \type {toks-tra.lua}: + +\startluacode + +if not modules then modules = { } end modules ['s-obsolete-tokens'] = { + version = 1.001, + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +local utfbyte, utfchar, utfvalues = utf.byte, utf.char, utf.values +local format, gsub = string.format, string.gsub +local tostring = tostring + +local tokens = tokens +local token = token -- the built in one +local tex = tex +local context = context +local commands = commands + +tokens.collectors = tokens.collectors or { } +local collectors = tokens.collectors + +collectors.data = collectors.data or { } +local collectordata = collectors.data + +collectors.registered = collectors.registered or { } +local registered = collectors.registered + +local report = logs.reporter("tokens","collectors") + +-- todo: +-- +-- register : macros that will be expanded (only for demo-ing) +-- flush : print back to tex +-- test : fancy stuff + +local get_next = token.scan_next or token.get_next +local create_token = token.create + +function collectors.install(tag,end_cs) + local data, d = { }, 0 + collectordata[tag] = data + end_cs = gsub(end_cs,"^\\","") + while true do + local t = get_next() + if t.csname == end_cs then + context[end_cs]() + return + else + d = d + 1 + data[d] = t + end + end +end + +local simple = { letter = "letter", other_char = "other" } + +function collectors.show(data) + -- We no longer have methods as we only used (in demos) method a + -- so there is no need to burden the core with this. We have a + -- different table anyway. + if type(data) == "string" then + data = collectordata[data] + end + if not data then + return + end + local ctx_NC = context.NC + local ctx_NR = context.NR + local ctx_bold = context.bold + local ctx_verbatim = context.verbatim + local function show(data) + for i=1,#data do + local token = data[i] + if type(token) == "table" then + show(token) + else + local cmdname = token.cmdname + local simple = simple[cmdname] + ctx_NC() + ctx_verbatim(simple or cmdname) + ctx_NC() + ctx_verbatim(simple and utfchar(token.index) or token.csname) + ctx_NC() + if token.active then context("active ") end + if token.expandable then context("expandable ") end + if token.protected then context("protected ") end + ctx_NC() + ctx_NR() + end + end + end + context.starttabulate { "|Tl|Tc|Tl|" } + ctx_NC() ctx_bold("cmd") + ctx_NC() ctx_bold("meaning") + ctx_NC() ctx_bold("properties") + ctx_NC() ctx_NR() + context.HL() + show(data) + context.stoptabulate() +end + +local function printlist(data) + if data and #data > 0 then + report("not supported (yet): printing back to tex") + end +end + +tokens.printlist = printlist -- will change to another namespace + +function collectors.flush(tag) + printlist(collectordata[tag]) +end + +function collectors.test(tag,handle) + report("not supported (yet): testing") +end + +function collectors.register(name) + report("not supported (yet): registering") +end + +-- -- old token code +-- +-- -- 1 = command, 2 = modifier (char), 3 = controlsequence id +-- +-- local create = token.create +-- local csname_id = token.csname_id +-- local command_id = token.command_id +-- local command_name = token.command_name +-- local get_next = token.get_next +-- local expand = token.expand +-- local csname_name = token.csname_name +-- +-- local function printlist(data) +-- if data and #data > 0 then +-- callbacks.push('token_filter', function () +-- callbacks.pop('token_filter') -- tricky but the nil assignment helps +-- return data +-- end) +-- end +-- end +-- +-- tokens.printlist = printlist -- will change to another namespace +-- +-- function collectors.flush(tag) +-- printlist(collectordata[tag]) +-- end +-- +-- function collectors.register(name) +-- registered[csname_id(name)] = name +-- end +-- +-- local call = command_id("call") +-- local letter = command_id("letter") +-- local other = command_id("other_char") +-- +-- function collectors.install(tag,end_cs) +-- local data, d = { }, 0 +-- collectordata[tag] = data +-- end_cs = gsub(end_cs,"^\\","") +-- local endcs = csname_id(end_cs) +-- while true do +-- local t = get_next() +-- local a, b = t[1], t[3] +-- if b == endcs then +-- context[end_cs]() +-- return +-- elseif a == call and registered[b] then +-- expand() +-- else +-- d = d + 1 +-- data[d] = t +-- end +-- end +-- end +-- +-- function collectors.show(data) +-- -- We no longer have methods as we only used (in demos) method a +-- -- so there is no need to burden the core with this. +-- if type(data) == "string" then +-- data = collectordata[data] +-- end +-- if not data then +-- return +-- end +-- local ctx_NC = context.NC +-- local ctx_NR = context.NR +-- local ctx_bold = context.bold +-- local ctx_verbatim = context.verbatim +-- context.starttabulate { "|T|Tr|cT|Tr|T|" } +-- ctx_NC() ctx_bold("cmd") +-- ctx_NC() ctx_bold("chr") +-- ctx_NC() +-- ctx_NC() ctx_bold("id") +-- ctx_NC() ctx_bold("name") +-- ctx_NC() ctx_NR() +-- context.HL() +-- for i=1,#data do +-- local token = data[i] +-- local cmd = token[1] +-- local chr = token[2] +-- local id = token[3] +-- local name = command_name(token) +-- ctx_NC() +-- ctx_verbatim(name) +-- ctx_NC() +-- if tonumber(chr) >= 0 then +-- ctx_verbatim(chr) +-- end +-- ctx_NC() +-- if cmd == letter or cmd == other then +-- ctx_verbatim(utfchar(chr)) +-- end +-- ctx_NC() +-- if id > 0 then +-- ctx_verbatim(id) +-- end +-- ctx_NC() +-- if id > 0 then +-- ctx_verbatim(csname_name(token) or "") +-- end +-- ctx_NC() ctx_NR() +-- end +-- context.stoptabulate() +-- end +-- +-- function collectors.test(tag,handle) +-- local t, w, tn, wn = { }, { }, 0, 0 +-- handle = handle or collectors.defaultwords +-- local tagdata = collectordata[tag] +-- for k=1,#tagdata do +-- local v = tagdata[k] +-- if v[1] == letter then +-- wn = wn + 1 +-- w[wn] = v[2] +-- else +-- if wn > 0 then +-- handle(t,w) +-- wn = 0 +-- end +-- tn = tn + 1 +-- t[tn] = v +-- end +-- end +-- if wn > 0 then +-- handle(t,w) +-- end +-- collectordata[tag] = t +-- end + +-- Interfacing: + +commands.collecttokens = collectors.install +commands.showtokens = collectors.show +commands.flushtokens = collectors.flush +commands.testtokens = collectors.test +commands.registertoken = collectors.register + +-- Redundant: + +-- function collectors.test(tag) +-- printlist(collectordata[tag]) +-- end + +-- For old times sake: + +collectors.dowithwords = collectors.test + +-- This is only used in old articles ... will move to a module: + +tokens.vbox = create_token("vbox") +tokens.hbox = create_token("hbox") +tokens.vtop = create_token("vtop") +tokens.bgroup = create_token(utfbyte("{"),1) +tokens.egroup = create_token(utfbyte("}"),2) + +tokens.letter = function(chr) return create_token(utfbyte(chr),11) end +tokens.other = function(chr) return create_token(utfbyte(chr),12) end + +tokens.letters = function(str) + local t, n = { }, 0 + for chr in utfvalues(str) do + n = n + 1 + t[n] = create_token(chr, 11) + end + return t +end + +function collectors.defaultwords(t,str) + if t then + local n = #t + n = n + 1 ; t[n] = tokens.bgroup + n = n + 1 ; t[n] = create_token("red") + for i=1,#str do + n = n + 1 ; t[n] = tokens.other('*') + end + n = n + 1 ; t[n] = tokens.egroup + end +end + +\stopluacode + +%D This used to be in \type {toks-tra.mkiv}: + +% used to be: \registerctxluafile{toks-tra}{} + +\unprotect + +%D Handy for manuals \unknown\ but not really used in practice, so it might +%D become a runtime loaded module instead. + +\unexpanded\def\starttokens [#1]{\ctxcommand{collecttokens("#1","stoptokens")}} + \let\stoptokens \relax +\unexpanded\def\flushtokens [#1]{\ctxcommand{flushtokens("#1")}} +\unexpanded\def\showtokens [#1]{\ctxcommand{showtokens("#1")}} +\unexpanded\def\testtokens [#1]{\ctxcommand{testtokens("#1")}} +\unexpanded\def\registertoken #1{\ctxcommand{registertoken("#1")}} + +\let\toks_show\showtokens % we also support the primitive + +\unexpanded\def\showtokens{\doifelsenextoptional\toks_show\normalshowtokens} + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/modules/mkiv/m-catchword.mkiv b/Master/texmf-dist/tex/context/modules/mkiv/m-catchword.mkiv index 70d713e44c1..86a3a2d55f8 100644 --- a/Master/texmf-dist/tex/context/modules/mkiv/m-catchword.mkiv +++ b/Master/texmf-dist/tex/context/modules/mkiv/m-catchword.mkiv @@ -27,7 +27,7 @@ local hlist_code = nodecodes.hlist local fontkern_code = kerncodes.fontkern local function set_catchword(t) - local nextpage = tex.lists.contrib_head + local nextpage = tex.lists.contribute_head or tex.lists.contrib_head if not nextpage then return end diff --git a/Master/texmf-dist/tex/context/modules/mkiv/m-chart.lua b/Master/texmf-dist/tex/context/modules/mkiv/m-chart.lua index 1cdfd9f65d8..df769067a0e 100644 --- a/Master/texmf-dist/tex/context/modules/mkiv/m-chart.lua +++ b/Master/texmf-dist/tex/context/modules/mkiv/m-chart.lua @@ -323,7 +323,7 @@ implement { implement { name = "flow_set_text", - arguments = { "string", "string" }, + arguments = "2 strings", actions = function(align,str) temp.texts[#temp.texts+1] = { align = align, @@ -358,7 +358,7 @@ implement { implement { name = "flow_set_label", - arguments = { "string", "string" }, + arguments = "2 strings", actions = function(location,text) temp.labels[#temp.labels+1] = { location = location, @@ -369,7 +369,7 @@ implement { implement { name = "flow_set_comment", - arguments = { "string", "string" }, + arguments = "2 strings", actions = function(location,text) local connections = temp.connections if connections then @@ -389,7 +389,7 @@ implement { implement { name = "flow_set_exit", - arguments = { "string", "string" }, + arguments = "2 strings", actions = function(location,text) temp.exits[#temp.exits+1] = { location = location, @@ -582,7 +582,7 @@ implement { implement { name = "flow_set_connection", - arguments = { "string", "string", "string" }, + arguments = "3 strings", actions = function(location,displacement,name) local dx, dy = lpegmatch(splitter,displacement) dx = tonumber(dx) @@ -718,8 +718,8 @@ local function process_connections(g,chart,xoffset,yoffset) end end -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 f_texttemplate_t = formatters["\\setvariables[flowcell:text][x=%s,y=%s,n=%i,align={%s},figure={%s},overlay={%s},destination={%s},realx=%s,realy=%s]"] +local f_texttemplate_l = formatters["\\doFLOWlabel{%i}{%i}{%i}{%i}{%i}"] local splitter = lpeg.splitat(":") local charttexts = { } -- permits " etc in mp @@ -751,6 +751,8 @@ local function process_texts(g,chart,xoffset,yoffset) local destination = cell.destination or "" local texts = cell.texts local noftexts = #texts + local realx = cell.realx or x + local realy = cell.realy or y if noftexts > 0 then for i=1,noftexts do local text = texts[i] @@ -758,7 +760,7 @@ local function process_texts(g,chart,xoffset,yoffset) local align = text.align or "" local align = validlabellocations[align] or align charttexts[#charttexts+1] = data - ctx_tographic(g,'flow_chart_draw_text(%s,%s,textext("%s")) ;',x,y,f_texttemplate_t(x,y,#charttexts,align,figure,overlay,destination)) + ctx_tographic(g,'flow_chart_draw_text(%s,%s,textext("%s")) ;',x,y,f_texttemplate_t(x,y,#charttexts,align,figure,overlay,destination,realx,realy)) if i == 1 then figure = "" overlay = "" @@ -766,7 +768,7 @@ local function process_texts(g,chart,xoffset,yoffset) end end elseif figure ~= "" or overlay ~= "" or destination ~= "" then - ctx_tographic(g,'flow_chart_draw_text(%s,%s,textext("%s")) ;',x,y,f_texttemplate_t(x,y,0,"",figure,overlay,destination)) + ctx_tographic(g,'flow_chart_draw_text(%s,%s,textext("%s")) ;',x,y,f_texttemplate_t(x,y,0,"",figure,overlay,destination,realx,realy)) end local labels = cell.labels for i=1,#labels do @@ -776,7 +778,7 @@ local function process_texts(g,chart,xoffset,yoffset) local location = validlabellocations[location] or location if text and text ~= "" then charttexts[#charttexts+1] = text - ctx_tographic(g,'flow_chart_draw_label(%s,%s,"%s",textext("%s")) ;',x,y,location,f_texttemplate_l(x,y,#charttexts)) + ctx_tographic(g,'flow_chart_draw_label(%s,%s,"%s",textext("%s")) ;',x,y,location,f_texttemplate_l(x,y,#charttexts,realx,realy)) end end local exits = cell.exits @@ -792,7 +794,7 @@ local function process_texts(g,chart,xoffset,yoffset) location == "t" and y == chart.to_y - 1 or location == "b" and y == chart.from_y + 1 then charttexts[#charttexts+1] = text - ctx_tographic(g,'flow_chart_draw_exit(%s,%s,"%s",textext("%s")) ;',x,y,location,f_texttemplate_l(x,y,#charttexts)) + ctx_tographic(g,'flow_chart_draw_exit(%s,%s,"%s",textext("%s")) ;',x,y,location,f_texttemplate_l(x,y,#charttexts,realx,realy)) end end end @@ -821,7 +823,7 @@ local function process_texts(g,chart,xoffset,yoffset) end if text and text ~= "" then charttexts[#charttexts+1] = text - ctx_tographic(g,'flow_chart_draw_comment(%s,%s,%s,"%s",%s,textext("%s")) ;',x,y,i,location,length,f_texttemplate_l(x,y,#charttexts)) + ctx_tographic(g,'flow_chart_draw_comment(%s,%s,%s,"%s",%s,textext("%s")) ;',x,y,i,location,length,f_texttemplate_l(x,y,#charttexts,realx,realy)) end end end @@ -1014,7 +1016,7 @@ local function makechart_indeed(chart) -- end --- We need to wrap because of tex.runtoks! +-- We need to wrap because of tex.runlocal! local function makechart(chart) context.hbox() diff --git a/Master/texmf-dist/tex/context/modules/mkiv/m-chart.mkvi b/Master/texmf-dist/tex/context/modules/mkiv/m-chart.mkvi index a9d3dfdd931..4dee9c7ef1f 100644 --- a/Master/texmf-dist/tex/context/modules/mkiv/m-chart.mkvi +++ b/Master/texmf-dist/tex/context/modules/mkiv/m-chart.mkvi @@ -46,7 +46,7 @@ \let\setupFLOWcharts\setupFLOWchart \let\setupFLOWlines \setupFLOWline \let\setupFLOWshapes\setupFLOWshape -\let\setupFLOWsets \setupFLOWset +%let\setupFLOWset \setupFLOWsets \setupFLOWcharts [\c!width=12\bodyfontsize, @@ -276,7 +276,7 @@ \let\location \FLOW_location \let\text \FLOW_text \let\label \FLOW_label - \let\comment \FLOW_comment + \overloaded\let\comment \FLOW_comment \let\exit \FLOW_exit \let\connection \FLOW_connection \let\include \FLOW_include @@ -285,7 +285,7 @@ \let\connect \FLOW_connection \let\locate \FLOW_location % - \let\includeFLOWchart\include + \overloaded\let\includeFLOWchart\include \to \everyFLOWchart \unexpanded\def\FLOW_name #name{\clf_flow_set_name{#name}\ignorespaces} @@ -322,12 +322,16 @@ [n=0, x=1, y=1, + realx=1, + realy=1, text=, align=, set=\setups{flowcell:text:place}] -\def\FLOWx{\getvariable{flowcell:text}{x}} % compatibility (for Willi) -\def\FLOWy{\getvariable{flowcell:text}{y}} % compatibility (for Willi) +\def\FLOWx {\getvariable{flowcell:text}{x}} % compatibility (for Willi) +\def\FLOWy {\getvariable{flowcell:text}{y}} % compatibility (for Willi) +\def\FLOWrealx{\getvariable{flowcell:text}{realx}} % compatibility (for Willi) +\def\FLOWrealy{\getvariable{flowcell:text}{realy}} % compatibility (for Willi) \defineoverlay [flowcell:figure] @@ -380,10 +384,12 @@ \endgroup \stopsetups -\unexpanded\def\doFLOWlabel#1#2#3% +\unexpanded\def\doFLOWlabel#1#2#3#4#5% {\begingroup \def\FLOWx{#1}% \def\FLOWy{#2}% + \def\FLOWrealx{#4}% + \def\FLOWrealy{#5}% \strut \getFLOWtext{#3}% \endgroup} diff --git a/Master/texmf-dist/tex/context/modules/mkiv/m-educat.mkiv b/Master/texmf-dist/tex/context/modules/mkiv/m-educat.mkiv index e39738e99a9..215bf31167a 100644 --- a/Master/texmf-dist/tex/context/modules/mkiv/m-educat.mkiv +++ b/Master/texmf-dist/tex/context/modules/mkiv/m-educat.mkiv @@ -71,7 +71,7 @@ \vbox{\hsize\wd\scratchbox\thinrule \ifcase\scratchcounter\else \setbox\scratchbox=\hbox{\space}% - \nobreak\hskip\zeropoint \!!minus \wd\scratchbox + \nobreak\hskip\zeropoint \s!minus \wd\scratchbox \vbox{\hsize\wd\scratchbox\thinrule}% \fi}}% \processisolatedwords{#2}\processisolatedword diff --git a/Master/texmf-dist/tex/context/modules/mkiv/m-examn.mkiv b/Master/texmf-dist/tex/context/modules/mkiv/m-examn.mkiv new file mode 100644 index 00000000000..3a98e53b1b3 --- /dev/null +++ b/Master/texmf-dist/tex/context/modules/mkiv/m-examn.mkiv @@ -0,0 +1,577 @@ +%D \module +%D [ file=m-examn, +%D version=2000.01.29, +%D title=\CONTEXT\ Extra Modules, +%D subtitle=Testing and Examination, +%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 is a pretty old style, written in 2000 so after 20 years it's time to check +%D if it works with \MKIV. The original version looks mostly the same as below and +%D runs ok with \MKII. The differences are in not using percent sign triggered +%D comments in the \JAVASCRIPT\ section (that was dropped), using \type {Yes} +%D instead of \type {On} as field value (because in those decades the \type {On} +%D value has proven to be fragile (maybe because of some hard coded \type {Yes} +%D checking). The macros lost \type {\long}, became \type {\unexpanded} and were +%D reformatted. +%D +%D If there is really demand for this I'll do a more major update. I see no reason +%D to change the 2000 \MKII\ logic now. + +% n number of permitted answers +% answer (set of) right answer(s) (one or list) +% weight weight of the answer(s) (one or list) +% method calculation method, for the moment 1 + +% hidden = true -> display = display.hidden + +% disguise methods, numbers and meaning secret +% randomizing answers +% allert will be a properly typeset message +% all checkfields instead of radio, gives more control + +\unprotect + +\def\c!answer {answer} +\def\c!question{question} +\def\c!weight {weight} + +\startJSpreamble {mpc} used now + + var RealTimeMode = false ; + var FeedBackMode = false ; + var CurrentFeedback = -1 ; + + var MPCnames = new Array() ; + var MPCanswers = new Array() ; + var MPCnumbers = new Array() ; + var MPCweights = new Array() ; + var MPCmethods = new Array() ; + var MPCerrors = new Array() ; + + function Warning (str) { + app.alert("warning: " + str) + } + + function FieldYN (name,n) { + return this.getField(name + ":" + n + ":yn") + } + + function FieldRW (name,n) { + return this.getField(name + ":" + n + ":rw") + } + + function NOfFields (name) { + var nof = 1 ; + while (FieldYN(name,nof)) { + ++nof + } + return --nof + } + + function SetScore (score,total) { + mpcs = this.getField("mpc-score") ; + mpct = this.getField("mpc-total") ; + mpcp = this.getField("mpc-percent") ; + if (RealTimeMode) { + var percent = 0 ; + if (Number(total) > 0) { + percent = Math.round(100.0 * (Number(score) / Number(total))) + } + if (mpcs) { + mpcs.value = score + } + if (mpct) { + mpct.value = total + } + if (mpcp) { + mpcp.value = percent + } + } else { + if (mpcs) { + mpcs.value = "" + } + if (mpct) { + mpct.value = "" + } + if (mpcp) { + mpcp.value = "" + } + } + this.dirty = false + } + + function CheckMPCmode () { + mpcr = this.getField("mpc-realtime") ; + if (mpcr) { + RealTimeMode = (mpcr.value == "Yes") + } + CheckScore() ; + this.dirty = false + } + + function DefineMPC (name, answer, number, weight, method) { + SetScore(0,0) ; + MPCnames[MPCnames.length] = name ; + if (answer=="") { + MPCanswers[name] = "0" + } else { + MPCanswers[name] = answer + } + if (number=="") { + MPCnumbers[name] = "0" + } else { + MPCnumbers[name] = number + } + if (weight=="") { + MPCweights[name] = "0" + } else { + MPCweights[name] = weight + } + if (method=="") { + MPCmethods[name] = "0" + } else { + MPCmethods[name] = method + } + } + + function CheckScore () { + var score = 0 ; + var total = 0 ; + var ok = false ; + for (var i=0;iNumber(MPCnumbers[name])) { + Warning("only " + MPCnumbers[name] + " choices permitted") ; + var v = FieldYN(name,number) ; + if (v.value == "Yes") { + v.value = "Off" + } + } + } + + function CheckMPC (name, number) { + if (! FeedBackMode) { + if (MPCnumbers[name] == 1) { + CheckMPCone(name,number) + } else { + CheckMPCmore(name,number) + } + if (RealTimeMode) { + CheckScore() + } else { + SetScore(0,0) + } + } else { + SetScore(0,0) + } + } + + function GoneToFeedback () { + var name = MPCnames[CurrentFeedback] ; + if (MPCerrors[name]) { + console.println("feedback:" + name) ; + this.gotoNamedDest("feedback:" + name) ; + return true + } else { + return false + } + } + + function NextFeedback () { + ++CurrentFeedback ; + while (CurrentFeedback < MPCnames.length) { + if (GoneToFeedback()) { + return + } else { + ++CurrentFeedback + } + } + CurrentFeedback = 0 ; + while (CurrentFeedback < MPCnames.length) { + if (GoneToFeedback()) { + return + } else { + ++CurrentFeedback + } + } + CurrentFeedback = -1 + } + + function PreviousFeedback () { + --CurrentFeedback ; + while (CurrentFeedback >= 0) { + if (GoneToFeedback()) { + return + } else { + --CurrentFeedback + } + } + CurrentFeedback = MPCnames.length ; + while (CurrentFeedback >= 0) { + if (GoneToFeedback()) { + return + } else { + --CurrentFeedback + } + } + CurrentFeedback = MPCnames.length + 1 + } + +\stopJSpreamble + +\definecolor[clickMPCcolor][blue] +\definecolor[rightMPCcolor][green] +\definecolor[wrongMPCcolor][red] + +\definecolor[MPCcolor][clickMPCcolor] + +\appendtoks + \definesymbol [mpc-y] [\mathematics{\color[clickMPCcolor]{\star}}] % yes + \definesymbol [mpc-n] [\hphantom{\symbol[mpc-y]}] % no + \definesymbol [mpc-r] [\mathematics{\color[rightMPCcolor]{\star}}] % right + \definesymbol [mpc-w] [\mathematics{\color[wrongMPCcolor]{\star}}] % wrong +\to \everystarttext + +\definereference [ResetItems] [JS(ResetItems)] +\definereference [CalculateItems] [JS(CalculateItems)] +\definereference [PreviousFeedback] [JS(PreviousFeedback)] +\definereference [NextFeedback] [JS(NextFeedback)] + +\setupfield + [mpc-field-yn] + [%\c!frame=\v!off, + \c!height=.8em, + \c!width=.8em, + \c!background=\v!color, + \c!backgroundcolor=gray] + +\setupfield + [mpc-field-rw] + [%\c!frame=\v!off, + \c!height=.8em, + \c!width=.8em, + \c!background=\v!color, + \c!background=gray] + +\setupfield + [mpc-data] + [%\c!frame=\v!off, + \c!height=3ex, + \c!location=\v!low, + \c!align=\v!middle, + \c!color=MPCcolor, + \c!background=\v!color, + \c!background=gray, + \c!option=\v!readonly] + +\setupfield + [mpc-mode] + [%\c!frame=\v!off, + \c!height=3ex, + \c!width=3ex, + \c!location=\v!low, + \c!color=MPCcolor, + \c!background=\v!color, + \c!background=gray, + \c!clickout=JS(CheckMPCmode)] + +\appendtoks + \definemainfield[mpc-score] [line] [mpc-data][][] + \definemainfield[mpc-total] [line] [mpc-data][][] + \definemainfield[mpc-percent] [line] [mpc-data][][] + \definemainfield[mpc-realtime][check][mpc-mode][mpc-y,mpc-n][mpc-n] +\to \everystarttext + +\newif\iftraceitems % \traceitemstrue + +\unexpanded\def\startMPCitems + {\dotripleempty\dostartMPCitems} + +\let\stopMPCitems\relax +\let\startMPCitem\relax +\let\stopMPCitem \relax + +\unexpanded\def\dostartMPCitems[#1][#2][#3]#4\stopMPCitems + {\bgroup + \getgparameters + [mpc:#1:] + [\c!answer=1, + \c!n=1, + \c!weight=1, + \c!method=1, + #2]% + \doglobal\newcounter\MPCitems + \unexpanded\def\startMPCitem##1\stopMPCitem + {\doglobal\increment\MPCitems + \edef\MPCitem{MPC:\MPCitems}% + \expandafter\setvalue\expandafter\MPCitem\expandafter + {\expandafter\handleMPCitem\expandafter{\MPCitems}{##1}}} + #4\relax + \unexpanded\def\handleMPCitem##1##2% + {\setJSpreamble{mpc:#1} + {DefineMPC + ("mpc:#1",% + "\getvalue{mpc:#1:\c!answer}",% + "\getvalue{mpc:#1:\c!n}",% + "\getvalue{mpc:#1:\c!weight}",% + "\getvalue{mpc:#1:\c!method}");}% + \definefield[mpc:#1:##1:rw][check][mpc-field-rw][mpc-r,mpc-w][mpc-r] + \definefield[mpc:#1:##1:yn][check][mpc-field-yn][mpc-y,mpc-n][mpc-n] + \setupfield[mpc-field-rw][\c!option={\v!readonly,\v!hidden}] + \setupfield[mpc-field-yn][\c!clickout=JS(CheckMPC{mpc:#1,##1})] + \mar{\iftraceitems{\txx##1}\hskip.5em\fi + %\fitfield[mpc:#1:##1:rw]\hskip.25em + %\fitfield[mpc:#1:##1:yn]} + \field[mpc:#1:##1:rw]\hskip.25em + \field[mpc:#1:##1:yn]} + ##2\par}% + \global\let\MPCdone\MPCitems + \global\unexpanded\def\fetchMPCitems + {\getrandomnumber\MPCitem{1}{\MPCitems}% + \doifdefined{MPC:\MPCitem} + {\getvalue{MPC:\MPCitem} + \doglobal\decrement\MPCdone + \global\letbeundefined{MPC:\MPCitem}}% + \ifcase\MPCdone\else + \expandafter\fetchMPCitems + \fi} + \startitemize[#3] + \fetchMPCitems + \stopitemize + \egroup} + +% \setupsystem +% [\c!random=\v!small] + +\protect + +\continueifinputfile{m-examn.mkiv} + +% \nopdfcompression + +\setupbodyfont[pagella,10pt] + +% \usemodule[m][examn] + +\setupinteraction + [state=start, + color=MPCcolor, + menu=on] + +\setupinteractionmenu + [right] + [state=start] + +\setupinteractionscreen + [option=max] + +\setuppapersize + [S6][S6] + +\setuplayout + [topspace=15pt, + backspace=40pt, + header=0pt, + footer=0pt, + height=middle, + rightmargin=0pt, + leftmargin=20pt, + leftmargindistance=5pt, + rightedge=100pt, + rightedgedistance=15pt, + width=430pt] + +\setupbackgrounds + [text][rightedge] + [frame=on, + frameoffset=5pt, + framecolor=MPCcolor] + +\startinteractionmenu[right] + \startalignment[middle] + \dontleavehmode \gotobox{\strut example test} [examplepage] \blank + \dontleavehmode \gotobox{\strut next feedback}[NextFeedback] \blank + \dontleavehmode \gotobox{\strut prev feedback}[PreviousFeedback] \blank + \dontleavehmode \gotobox{\strut submit} [SubmitForm{mailto:pragma@wxs.nl}] \blank + \dontleavehmode \gotobox{\strut reset} [ResetItems] \blank + \dontleavehmode \gotobox{\strut calculate} [CalculateItems] \blank + \vfill + score \blank[small] \dontleavehmode \field[mpc-score] \blank + max score \blank[small] \dontleavehmode \field[mpc-total] \blank + percentage \blank[small] \dontleavehmode \field[mpc-percent] \blank + realtime \blank[small] \dontleavehmode \field[mpc-realtime] \blank + \kern0pt + \stopalignment +\stopinteractionmenu + +\starttext + +\title [examplepage] {A simple MPC demo (toggle mode)} + +\startMPCitems[mpc-1][answer=3][a,packed] + + \startMPCitem this is alpha \stopMPCitem + \startMPCitem and this is beta \stopMPCitem + \startMPCitem but how about gamma (ok) \stopMPCitem + +\stopMPCitems + +\startMPCitems[mpc-5][answer={2,3,4},n=2][n,packed] + + \startMPCitem this is alpha \stopMPCitem + \startMPCitem and this is beta (ok, 2 ok's permitted) \stopMPCitem + \startMPCitem but how about gamma (ok, 2 ok's permitted) \stopMPCitem + \startMPCitem or delta (ok, 2 ok's permitted) \stopMPCitem + \startMPCitem or epsilon \stopMPCitem + +\stopMPCitems + +\startMPCitems[mpc-6][answer={2,3,4},weight={2,1,3},n=2][g,packed] + + \startMPCitem this is alpha \stopMPCitem + \startMPCitem and this is beta (ok, 2 ok's permitted, weight is 2) \stopMPCitem + \startMPCitem but how about gamma (ok, 2 ok's permitted, weight is 1) \stopMPCitem + \startMPCitem or delta (ok, 2 ok's permitted, weight is 3) \stopMPCitem + \startMPCitem or epsilon \stopMPCitem + +\stopMPCitems + +\startMPCitems[mpc-8][answer=1,weight=2][packed] + + \startMPCitem this is alpha (ok, weight is 2) \stopMPCitem + \startMPCitem and this is beta \stopMPCitem + \startMPCitem but how about gamma \stopMPCitem + \startMPCitem or delta \stopMPCitem + +\stopMPCitems + +\title [feedback:mpc:mpc-1] {Feedback on MPC 1} whatever +\title [feedback:mpc:mpc-5] {Feedback on MPC 5} whatever +\title [feedback:mpc:mpc-6] {Feedback on MPC 6} whatever +\title [feedback:mpc:mpc-8] {Feedback on MPC 8} whatever + +\stoptext diff --git a/Master/texmf-dist/tex/context/modules/mkiv/m-format.mkiv b/Master/texmf-dist/tex/context/modules/mkiv/m-format.mkiv index 3a0a5bebd51..083f6ed63fe 100644 --- a/Master/texmf-dist/tex/context/modules/mkiv/m-format.mkiv +++ b/Master/texmf-dist/tex/context/modules/mkiv/m-format.mkiv @@ -190,7 +190,7 @@ {\placeformatlinecounter}}}} {\let\doplaceformatlinecounter\relax}% \global\setfalse\formatforcedbreak - \def\\{\break\global\settrue\formatforcedbreak}% + \enforced\def\\{\break\global\settrue\formatforcedbreak}% \hsize\formatwidth \doglobal\increment\formatlinecounter \par diff --git a/Master/texmf-dist/tex/context/modules/mkiv/m-gnuplot.mkxl b/Master/texmf-dist/tex/context/modules/mkiv/m-gnuplot.mkxl new file mode 100644 index 00000000000..e844edd1bb3 --- /dev/null +++ b/Master/texmf-dist/tex/context/modules/mkiv/m-gnuplot.mkxl @@ -0,0 +1,97 @@ +%D \module +%D [ file=m-gnuplot, +%D version=2020.02.10, +%D title=\CONTEXT\ Extra Modules, +%D subtitle=Gnuplot, +%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 is a variant on the \GNUPLOT\ terminal code. At some point (when there is a +%D reason) I will make a proper environment that can be used for embedded code. + +\permanent\protected\def\includegnuplotsvgfile[#1]% + {\hbox\bgroup + \ctxlua{metapost.startsvghashing()}% + \includesvgfile[#1]% + \ctxlua{metapost.stopsvghashing()}% + \egroup} + +\startluacode + +local modificationtime = lfs.modification +local longtostring = string.longtostring +local formatters = string.formatters +local expandfilename = dir.expandname +local isfile = lfs.isfile + +local runner = sandbox.registerrunner { + name = "gnuplot to svg", + program = "gnuplot", + template = longtostring [[ + -e "set output '%newname%'; set terminal svg" + "%oldname%" + ]], + checkers = { + oldname = "readable", + newname = "writable", + }, +} + +figures.programs.gnuplot = { + runner = runner, +} + +local function remap(specification) + local oldname = specification.fullname + if oldname then + local newname = file.replacesuffix(oldname,"svg") + local oldtime = modificationtime(oldname) or 0 + local newtime = modificationtime(newname) or 0 + if newtime == 0 or oldtime > newtime then + runner { + newname = expandfilename(newname), + oldname = expandfilename(oldname), + } + end + if isfile(newname) then + local only = file.nameonly(newname) + local name = formatters["svg-%s-inclusion"](only) + local code = formatters["\\includegnuplotsvgfile[%s]\\resetbuffer[%s]"](newname,name) + buffers.assign(name,code) + specification.format = "buffer" + specification.fullname = name + end + end + return specification +end + +figures.remappers.gp = { svg = remap } + +\stopluacode + +\continueifinputfile{m-gnuplot.mkxl} + +\startluacode +io.savedata("m-gnuplot-demo.gp", [[ +set format xy "$%g$" + +set title 'This is a plot of $y=\\sin(x)$' +set xlabel 'This is the $x$ axis' +set ylabel 'This is the $y$ axis' + +plot [0:6.28] [0:1] sin(x) +]]) +\stopluacode + +\starttext + + \externalfigure[m-gnuplot-demo.gp][conversion=svg,width=4cm] + + \externalfigure[m-gnuplot-demo.gp][conversion=svg,width=8cm] + +\stoptext diff --git a/Master/texmf-dist/tex/context/modules/mkiv/m-ipsum.mkiv b/Master/texmf-dist/tex/context/modules/mkiv/m-ipsum.mkiv index 7ba78ee2eaf..7b5074a49cf 100644 --- a/Master/texmf-dist/tex/context/modules/mkiv/m-ipsum.mkiv +++ b/Master/texmf-dist/tex/context/modules/mkiv/m-ipsum.mkiv @@ -101,6 +101,23 @@ function moduledata.ipsum.direct(settings) end end +interfaces.implement { + name = "ipsum", + protected = true, + actions = moduledata.ipsum.typeset, + arguments = { { + { "alternative" }, + { "filename" }, + { "n" }, + { "left" }, + { "right" }, + { "before" }, + { "after" }, + { "inbetween" }, + { "separator" }, + } }, +} + \stopluacode \unprotect @@ -129,26 +146,25 @@ end \useipsumstyleandcolor\c!style\c!color % hm, also changes dates \uselanguageparameter\ipsumparameter - \ctxlua{moduledata.ipsum.typeset { - alternative = "\ipsumparameter\c!alternative", - filename = "\ipsumparameter\c!file", - n = "\ipsumparameter\c!n", - left = "\luaescapestring{\ipsumparameter\c!left}", - right = "\luaescapestring{\ipsumparameter\c!right}", - before = "\luaescapestring{\ipsumparameter\c!before}", - after = "\luaescapestring{\ipsumparameter\c!after}", - inbetween = "\luaescapestring{\ipsumparameter\c!inbetween}", - }} + \clf_ipsum + alternative {\ipsumparameter\c!alternative} + filename {\ipsumparameter\c!file} + n {\ipsumparameter\c!n} + left {\ipsumparameter\c!left} + right {\ipsumparameter\c!right} + before {\ipsumparameter\c!before} + after {\ipsumparameter\c!after} + inbetween {\ipsumparameter\c!inbetween} + \relax \stopsetups \def\directipsum#1% only one argument, expanded - {\ctxlua{moduledata.ipsum.typeset { - alternative = "\namedipsumparameter{#1}\c!alternative", - filename = "\namedipsumparameter{#1}\c!file", - n = "\namedipsumparameter{#1}\c!n", - separator = "\luaescapestring{\ipsumparameter\c!separator}", - }} -} + {\clf_ipsum + alternative {\namedipsumparameter{#1}\c!alternative} + filename {\namedipsumparameter{#1}\c!file} + n {\namedipsumparameter{#1}\c!n} + separator {\ipsumparameter\c!separator} + \relax} \protect diff --git a/Master/texmf-dist/tex/context/modules/mkiv/m-morse.mkvi b/Master/texmf-dist/tex/context/modules/mkiv/m-morse.mkvi index a2c20dff745..a80b3d56fc1 100644 --- a/Master/texmf-dist/tex/context/modules/mkiv/m-morse.mkvi +++ b/Master/texmf-dist/tex/context/modules/mkiv/m-morse.mkvi @@ -227,8 +227,8 @@ end \def\MorseHeight {0.2em} %def\MorseShort {\dontleavehmode\blackrule[\c!height=\MorseHeight,\c!width=\dimexpr\MorseWidth]} %def\MorseLong {\dontleavehmode\blackrule[\c!height=\MorseHeight,\c!width=3\dimexpr\MorseWidth]} -\def\MorseShort {\dontleavehmode\vrule\!!width \dimexpr\MorseWidth\!!height\MorseHeight\!!depth\zeropoint\relax} -\def\MorseLong {\dontleavehmode\vrule\!!width3\dimexpr\MorseWidth\!!height\MorseHeight\!!depth\zeropoint\relax} +\def\MorseShort {\dontleavehmode\vrule\s!width \dimexpr\MorseWidth\s!height\MorseHeight\s!depth\zeropoint\relax} +\def\MorseLong {\dontleavehmode\vrule\s!width3\dimexpr\MorseWidth\s!height\MorseHeight\s!depth\zeropoint\relax} \def\MorseBetweenCharacters {\kern\MorseWidth} \def\MorseBetweenWords {\hskip3\dimexpr\MorseWidth\relax} \def\MorseSpace {\hskip7\dimexpr\MorseWidth\relax} diff --git a/Master/texmf-dist/tex/context/modules/mkiv/m-nodechart.lua b/Master/texmf-dist/tex/context/modules/mkiv/m-nodechart.lua index 8273f365a91..98e09f4b518 100644 --- a/Master/texmf-dist/tex/context/modules/mkiv/m-nodechart.lua +++ b/Master/texmf-dist/tex/context/modules/mkiv/m-nodechart.lua @@ -62,8 +62,8 @@ function formatters.dir(n,comment) return format("\\doFLOWdirnode{%s}{%s}{%s}",comment,"dir",n.dir) end -function formatters.localpar(n,comment) - return format("\\doFLOWdirnode{%s}{%s}{%s}",comment,"localpar",n.dir) +function formatters.par(n,comment) + return format("\\doFLOWdirnode{%s}{%s}{%s}",comment,"par",n.dir) end -- I will make a dedicated set of shapes for this. diff --git a/Master/texmf-dist/tex/context/modules/mkiv/m-ntb-to-xtb.mkiv b/Master/texmf-dist/tex/context/modules/mkiv/m-ntb-to-xtb.mkiv index 55b4ab25926..d48191ebc3d 100644 --- a/Master/texmf-dist/tex/context/modules/mkiv/m-ntb-to-xtb.mkiv +++ b/Master/texmf-dist/tex/context/modules/mkiv/m-ntb-to-xtb.mkiv @@ -1,4 +1,8 @@ -\loadmkvifile{tabl-xnt} +\ifcase\contextlmtxmode + \loadmkvifile{tabl-xnt} +\else + \loadmklxfile{tabl-xnt} +\fi \mapTABLEtoxtable diff --git a/Master/texmf-dist/tex/context/modules/mkiv/m-oldfun.mkiv b/Master/texmf-dist/tex/context/modules/mkiv/m-oldfun.mkiv index 7ec779c41cb..f20d7d8e961 100644 --- a/Master/texmf-dist/tex/context/modules/mkiv/m-oldfun.mkiv +++ b/Master/texmf-dist/tex/context/modules/mkiv/m-oldfun.mkiv @@ -648,7 +648,7 @@ \dontcomplain \setuptolerance[\v!verytolerant]% == \tolerance4500 \hsize#1% - \def\\{\softbreak}% + \enforced\def\\{\softbreak}% \!!heighta#4% \!!heightb#2% \doloop @@ -690,8 +690,8 @@ \advance\scratchdimen#2\relax \NormalizeFontWidth #1% - {\def\+{\global\settrue\NFSpread\gobbleuntil\relax}% - \def\\{\gobbleuntil\relax}% newline + {\enforced\def\+{\global\settrue\NFSpread\gobbleuntil\relax}% + \enforced\def\\{\gobbleuntil\relax}% newline \setupspacing #6\relax}% {\scratchdimen}% diff --git a/Master/texmf-dist/tex/context/modules/mkiv/m-oldnum.mkiv b/Master/texmf-dist/tex/context/modules/mkiv/m-oldnum.mkiv index a240cdb58c3..5109cca1225 100644 --- a/Master/texmf-dist/tex/context/modules/mkiv/m-oldnum.mkiv +++ b/Master/texmf-dist/tex/context/modules/mkiv/m-oldnum.mkiv @@ -109,7 +109,7 @@ {\mbox{\grabdigit#1\relax}} % adding $ $ goes wrong in tabulate \def\grabdigit - {\futurelet\next\scandigit} + {\futurelet\nexttoken\scandigit} %D Watch the test for \type {\nextobeyedline}, because the %D endofline token can be \type {\def'd}, not \type {\let}'d, @@ -119,15 +119,15 @@ \ifx\normalmathshift\undefined \let\normalmathshift=$ \fi \unexpanded\def\scandigit - {\ifx\next\blankspace + {\ifx\nexttoken\blankspace \let\next\handledigits - \else\ifx\next\nextobeyedline % the indirect one + \else\ifx\nexttoken\nextobeyedline % the indirect one \let\next\handledigits - \else\ifx\next\bgroup + \else\ifx\nexttoken\bgroup \let\next\handledigits - \else\ifx\next\egroup + \else\ifx\nexttoken\egroup \let\next\handledigits - \else\ifx\next\normalmathshift + \else\ifx\nexttoken\normalmathshift \let\next\handledigits \else \let\next\collectdigit diff --git a/Master/texmf-dist/tex/context/modules/mkiv/m-punk.mkiv b/Master/texmf-dist/tex/context/modules/mkiv/m-punk.mkiv index 47f1a0177ff..9eb7411babb 100644 --- a/Master/texmf-dist/tex/context/modules/mkiv/m-punk.mkiv +++ b/Master/texmf-dist/tex/context/modules/mkiv/m-punk.mkiv @@ -17,6 +17,11 @@ %D https://www.youtube.com/watch?v=g5c2Htj8Vtw %D \stoptyping +\ifcase\contextlmtxmode\else + \writestatus{punk}{use metapost library punk instead} + \endinput +\fi + \startluacode local concat = table.concat local round = math.round diff --git a/Master/texmf-dist/tex/context/modules/mkiv/m-scite.mkiv b/Master/texmf-dist/tex/context/modules/mkiv/m-scite.mkiv index 315cb3bed8b..659d5f58dfd 100644 --- a/Master/texmf-dist/tex/context/modules/mkiv/m-scite.mkiv +++ b/Master/texmf-dist/tex/context/modules/mkiv/m-scite.mkiv @@ -311,13 +311,16 @@ moduledata.scite = scite \stopluacode -\definetyping[TEX] [option=cld] -\definetyping[LUA] [option=lua] +%definetyping[TEX] [option=cld] +\setuptyping [TEX] [option=cld] +%definetyping[LUA] [option=lua] +\setuptyping [LUA] [option=lua] \definetyping[BTX] [option=bibtex] \definetyping[MPS] [option=mps] -\definetyping[MP] [option=mp] +%definetyping[MP] [option=mp] +\setuptyping [MP] [option=mp] \definetyping[PDF] [option=pdf] -\definetyping[CPP] [option=web] +\definetyping[CPP] [option=cpp] % Which is kind of like the web one. \definetyping[WEB] [option=web] \definetyping[TXT] [option=txt] \definetyping[BNF] [option=bnf] % I might use this in the metafun manual. @@ -336,7 +339,7 @@ moduledata.scite = scite \unexpanded\def\buff_scite_slxb#1% {% we can have a side float \advance\hangindent\numexpr#1+2\relax\scitespaceskip - \begstrut\hskip#1\scitespaceskip + \begstrut\hskip#1\scitespaceskip\relax \ifcase\hangafter \hangafter\plusone\relax \fi} @@ -378,7 +381,7 @@ moduledata.scite = scite \let\slxT \lettertilde \let\slxS \fixedspace -\let\slxS \buff_scite_slxs +%let\slxS \buff_scite_slxs \let\slxF \buff_scite_slxf \def\module_scite_inherit_typing @@ -397,6 +400,14 @@ moduledata.scite = scite {\scitebuffer[\ifx\currentscitelexer\empty tex\else\currentscitelexer\fi][@scite@]% \endgroup} +\definelines + [scitelines] + +\setuplines + [scitelines] + [\c!before=, + \c!after=] + \unexpanded\def\scitefile {\dosingleargument\module_scite_file} @@ -410,9 +421,9 @@ moduledata.scite = scite \dontcomplain \raggedright \startcontextcode - \startlines + \startscitelines \getbuffer[lex] - \stoplines + \stopscitelines \stopcontextcode \endgroup} @@ -432,9 +443,9 @@ moduledata.scite = scite \module_scite_inherit_typing \dontcomplain \raggedright - \startlines + \startscitelines \getbuffer[lex] - \stoplines + \stopscitelines \endgroup} \unexpanded\def\sciteinlinebuffer @@ -476,14 +487,14 @@ moduledata.scite = scite \tt \installscitecommandsdisplay \dontcomplain -\buff_verbatim_initialize_typing_one -\buff_verbatim_set_line_margin + \buff_verbatim_initialize_typing_one + \buff_verbatim_set_line_margin \raggedright - \startlines + \startscitelines \clf_getbuffer{lex}} \unexpanded\def\stopDisplayScite - {\stoplines + {\stopscitelines \endgroup} \unexpanded\def\slxbreak diff --git a/Master/texmf-dist/tex/context/modules/mkiv/m-sql.mkiv b/Master/texmf-dist/tex/context/modules/mkiv/m-sql.mkiv index ed9dae99a4e..bb62610ea13 100644 --- a/Master/texmf-dist/tex/context/modules/mkiv/m-sql.mkiv +++ b/Master/texmf-dist/tex/context/modules/mkiv/m-sql.mkiv @@ -17,8 +17,8 @@ \registerctxluafile{util-sql}{} \ifcase\contextlmtxmode\else - \registerctxluafile{libs-imp-mysql}{} - \registerctxluafile{libs-imp-sqlite}{} + \registerctxluafile{libs-imp-mysql}{autosuffix} + \registerctxluafile{libs-imp-sqlite}{autosuffix} \fi \setupmodule diff --git a/Master/texmf-dist/tex/context/modules/mkiv/m-steps.lua b/Master/texmf-dist/tex/context/modules/mkiv/m-steps.lua index ce84866a4d5..bbc267274ae 100644 --- a/Master/texmf-dist/tex/context/modules/mkiv/m-steps.lua +++ b/Master/texmf-dist/tex/context/modules/mkiv/m-steps.lua @@ -399,7 +399,7 @@ end interfaces.implement { name = "step_start_chart", - arguments = { "string", "string" }, + arguments = "2 strings", actions = step_start_chart, } diff --git a/Master/texmf-dist/tex/context/modules/mkiv/m-steps.mkvi b/Master/texmf-dist/tex/context/modules/mkiv/m-steps.mkvi index 873015fd659..fb2000d40d2 100644 --- a/Master/texmf-dist/tex/context/modules/mkiv/m-steps.mkvi +++ b/Master/texmf-dist/tex/context/modules/mkiv/m-steps.mkvi @@ -428,12 +428,16 @@ \startxmlsetups xml:step:define \xmlsetsetup {#1} - {stepchart|steptable|stepaligntable|cells|texts|stepcell|cell|text} + {stepchart|steptable|stepaligntable|cells|texts|stepcell|cell|text|br} {xml:step:*} \stopxmlsetups \xmlregistersetup{xml:step:define} +\startxmlsetups xml:step:br + \crlf +\stopxmlsetups + \startxmlsetups xml:step:stepchart \startSTEPchart[\c!category=\xmlatt{#1}{class}] \xmlflush{#1} @@ -492,9 +496,17 @@ \stopxmlsetups \startxmlsetups xml:step:text - \text - [\xmlatt{#1}{class}] - {\xmlflush{#1}} + \doifelse {\xmlatt{#1}{option}} {paragraph} { + \text + [\xmlatt{#1}{class}] + {\framed + [\c!location=\v!middle,\c!align={\v!lohi,\v!flushleft},\c!offset=0pt,\c!frame=\v!no] + {\ignorespaces\xmlflush{#1}\removeunwantedspaces}} + } { + \text + [\xmlatt{#1}{class}] + {\xmlflush{#1}} + } \stopxmlsetups \protect @@ -519,11 +531,21 @@ \startbuffer - some cell - some text - some cell - some text - some cell + some cell A + some text 1 + some cell B + some text 2 + some cell C + +\stopbuffer + +\typebuffer \processxmlbuffer + +\startbuffer + + some cell A + some more
text 1
+ some cell B
\stopbuffer diff --git a/Master/texmf-dist/tex/context/modules/mkiv/m-system-aliasing.mkiv b/Master/texmf-dist/tex/context/modules/mkiv/m-system-aliasing.mkiv new file mode 100644 index 00000000000..4661cc503a1 --- /dev/null +++ b/Master/texmf-dist/tex/context/modules/mkiv/m-system-aliasing.mkiv @@ -0,0 +1,120 @@ +%D \module +%D [ file=m-system-aliasing, +%D version=2020.07.08, +%D title=\CONTEXT\ Modules, +%D subtitle=Loading generic stuff, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] + +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\startmodule[system-aliasing] + +\startluacode + local next = next + local find, topattern = string.find, string.topattern + + local aliases = { } + local replacer = false + local filenames = false + local wildcards = false + local enabled = false + + local report = logs.reporter("system", "aliasing") + + -- This is not yet perfect as we actually need to quit at a non token. + + interfaces.implement { + name = "registeralias", + public = true, + arguments = { "csname", "csname" }, + actions = function(old,new) + aliases[old] = new + replacer = false + end + } + + interfaces.implement { + name = "registeraliasfile", + public = true, + arguments = "string", + actions = function(name) + if find(name,"%*") then + name = topattern(name) + if wildcards then wildcards[name] = true else wildcards = { [name] = true } end + else + if filenames then filenames[name] = true else filenames = { [name] = true } end + end + if not enabled then + utilities.sequencers.appendaction( + resolvers.openers.helpers.textfileactions, + "system","resolvers.macros.processgeneric" + ) + utilities.sequencers.enableaction( + resolvers.openers.helpers.textfileactions, + "resolvers.macros.processgeneric" + ) + enabled = true + end + end + } + + local function found(name) + if filenames and filenames[name] then + return true + end + if wildcards then + for k, v in next, wildcards do + if find(name,k) then + return true + end + end + end + return false + end + + local Cs, lpegmatch = lpeg.Cs, lpeg.match + + local utfchartabletopattern = lpeg.utfchartabletopattern + local utf8character = lpeg.patterns.utf8character + local escapecharacter = lpeg.P("\\") + local terminal = lpeg.S([[`"'~@#$%^&_-+/*=(){}[]<>:;,.!?|\\]]) + + lpeg.P(-1) + local lpegmatch = lpeg.match + + function resolvers.macros.processgeneric(str,name) + if found(name) then + report("file %a",name) + if not replacer then + replacer = Cs( ( + escapecharacter + * (utfchartabletopattern(aliases) / aliases) + * terminal + + utf8character + )^0 ) + end + str = lpegmatch(replacer,str) or str + end + return str + end + +\stopluacode + +\registeralias \protected \normalprotected +\registeralias \unexpanded \normalunexpanded +\registeralias \expanded \normalexpanded + +%D \starttyping +%D \registeraliasfile{rubish.tex} +%D \registeraliasfile{generic/*.tex} +%D +%D % e.g. \def\foo{\unexpanded{test}} +%D +%D \input rubish.tex +%D \input generic/foo.tex +%D \stoptyping + +\stopmodule diff --git a/Master/texmf-dist/tex/context/modules/mkiv/m-system-readers.mkxl b/Master/texmf-dist/tex/context/modules/mkiv/m-system-readers.mkxl new file mode 100644 index 00000000000..a077b20a313 --- /dev/null +++ b/Master/texmf-dist/tex/context/modules/mkiv/m-system-readers.mkxl @@ -0,0 +1,148 @@ +%D \module +%D [ file=m-system-readers, +%D version=2021.02.13, +%D title=\CONTEXT\ Modules, +%D subtitle=Reading from files, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] + +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\startmodule[system-readers] + +% \unprotect +% +% \installcorenamespace {markedlines} +% +% \permanent\protected\def\startmarkedlines[#1]% +% {\edef\scratchstring{#1}% +% \scratchcounter\numexpr\inputlineno+\plusone\relax +% \gobbleuntilandfinalize\stopmarkedlines} +% +% \permanent\protected\def\stopmarkedlines +% {\edefcsname\??markedlines\scratchstring\endcsname +% {{\the\scratchcounter}{\the\numexpr\inputlineno+\minusone\relax}}} +% +% \protected\def\firstmarkedline#1% +% {\numexpr +% \ifcsname\??markedlines#1\endcsname +% \normalexpanded{\noexpand\firstoftwoarguments\lastnamedcs}% +% \else +% \zerocount +% \fi +% \relax} +% +% \protected\def\lastmarkedline#1% +% {\numexpr +% \ifcsname\??markedlines#1\endcsname +% \normalexpanded{\noexpand\secondoftwoarguments\lastnamedcs}% +% \else +% \zerocount +% \fi +% \relax} +% +% \protected\def\markedlines#1% +% {\ifcsname\??markedlines\scratchstring\endcsname\lastnamedcs\else{0}{0}\fi} +% +% \protect + +\startluacode + + local createtoken = token.create + local gobbletoken = token.gobble + local integer_value = tokens.values.integer + + local marked = { } + + interfaces.implement { + name = "startmarkedlines", + public = true, + protected = true, + arguments = "optional", + actions = function(tag) + local start = status.readstate.linenumber + 1 + gobbletoken(createtoken("startmarkedlines"),createtoken("stopmarkedlines")) + local state = status.readstate + marked[tag] = { state.filename, start, state.linenumber - 1 } + end + } + + + interfaces.implement { + name = "markedfilename", + public = true, + -- usage = "value", + arguments = "string", + actions = function(tag) + local m = marked[tag] + -- return m and m[1] or "" + context(m and m[1] or "") + end + } + + interfaces.implement { + name = "firstmarkedline", + public = true, + usage = "value", + arguments = "string", + actions = function(tag) + local m = marked[tag] + return integer_value, m and m[2] or 0 + end + } + + interfaces.implement { + name = "lastmarkedline", + public = true, + usage = "value", + arguments = "string", + actions = function(tag) + local m = marked[tag] + return integer_value, m and m[3] or 0 + end + } + +\stopluacode + +\continueifinputfile{m-system-readers.mkxl} + +\starttext + +\startmarkedlines[test] +SOME LINE 1 +SOME LINE 2 +SOME LINE 3 +SOME LINE 4 +\stopmarkedlines + +\startmarkedlines[more] +SOME MORE 1 +SOME MORE 2 +SOME MORE 3 +SOME MORE 4 +\stopmarkedlines + +\begingroup + \newlocalread\myreada + \immediate\openin\myreada {\markedfilename{test}} + \dostepwiserecurse{\lastmarkedline{test}}{\firstmarkedline{test}}{-1}{ + \readline\myreada line #1 to \scratchstring #1 : \scratchstring \par + } + \immediate\closein\myreada +\endgroup + +\blank + +\begingroup + \newlocalread\myreada + \immediate\openin\myreada {\markedfilename{more}} + \dostepwiserecurse{\firstmarkedline{more}}{\lastmarkedline{more}}{1}{ + \read \myreada line #1 to \scratchstring #1 : \scratchstring \par + } + \immediate\closein\myreada +\endgroup + +\stoptext diff --git a/Master/texmf-dist/tex/context/modules/mkiv/m-tikz.mkiv b/Master/texmf-dist/tex/context/modules/mkiv/m-tikz.mkiv new file mode 100644 index 00000000000..9267f90d49b --- /dev/null +++ b/Master/texmf-dist/tex/context/modules/mkiv/m-tikz.mkiv @@ -0,0 +1,75 @@ +%D A fixed variant if the t-tikz module distributed with tikz. + +\ifdefined\pdflastxpos \else + \unprotect + \frozen\overloaded\protected\def\pdflastxpos{\numexpr\clf_lastxpos\relax} + \frozen\overloaded\protected\def\pdflastypos{\numexpr\clf_lastypos\relax} + \protect +\fi + + +\pushoverloadmode + + \pushcatcodetable + + \setcatcodetable\texcatcodes + + \catcode`\@=11 + \catcode`\|=12 + \catcode`\!=12 + + \input t-pgf.tex + \input t-pgffor.tex + \input tikz.code.tex + + \popcatcodetable + +\popoverloadmode + +\permanent\protected\def\tikzerrormessage#1#2#3% + {\writestatus{#1}{#2}} + +\ifcase\contextlmtxmode + + \let\starttikzsettings\relax + \let\stoptikzsettings \relax + + \protected\def\starttikzpicture + {% \dontleavehmode + \begingroup + \ifdefined\PackageError\else \let\PackageError\tikzerrormessage \fi + \tikzpicture} + + \protected\def\stoptikzpicture + {\endtikzpicture + \endgroup} + +\else + + % for now: + + \overloadmode\zerocount + + % but this will be mandate for settings outside the start .. stop + + \permanent\protected\def\starttikzsettings + {\pushoverloadmode} + + \permanent\protected\def\stoptikzsettings + {\popoverloadmode} + + \permanent\protected\def\starttikzpicture + {\dontleavehmode + \hcontainer\bgroup + % \pushoverloadmode + \ifdefined\PackageError\else \let\PackageError\tikzerrormessage \fi + \tikzpicture} + + \permanent\protected\def\stoptikzpicture + {\endtikzpicture + % \popoverloadmode + \egroup} + +\fi + +\stopmodule diff --git a/Master/texmf-dist/tex/context/modules/mkiv/m-timing.mkxl b/Master/texmf-dist/tex/context/modules/mkiv/m-timing.mkxl new file mode 100644 index 00000000000..3edfd14e235 --- /dev/null +++ b/Master/texmf-dist/tex/context/modules/mkiv/m-timing.mkxl @@ -0,0 +1,113 @@ +%D \module +%D [ file=m-timing, +%D version=2007.12.23, +%D title=\CONTEXT\ Modules, +%D subtitle=Timing, +%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 Todo: adapt to latest metafun magic. + +\ifdefined\ShowNamedUsage \endinput \fi + +%D Written at the end of 2007, this module is dedicated to Taco. Reaching this +%D point in \LUATEX\ was a non trivial effort. By visualizing a bit what happens +%D when pages come out of \LUATEX, you may get an idea what is involved. It took +%D much time an dedication to reach this point in the development. Add to that +%D those daily Skype intense discussion, testing and debugging moments. Time flies +%D but progress is impressive. The motto of this module could be: what you see +%D is what you get. An there is much more to come \unknown. + +% \usemodule[timing] +% \setupcolors[state=start] +% \starttext +% \dorecurse{200}{\input tufte \par} \ShowUsage{} +% \stoptext + +\definecolor[usage:line] [darkred] +\definecolor[usage:time] [darkblue] +\definecolor[usage:frame][darkgray] + +\ctxloadluafile{trac-tim.lmt} + +\startluacode +local progress = moduledata.progress + +function progress.show(filename,names,other) + if not filename or filename == "" then + filename = progress.defaultfilename or "" + end + for n, name in pairs(progress.names(filename)) do + if string.find(name,names) and name ~= other and name ~= "variables: lasttime" then + context.ShowNamedUsage(filename,name or "",other or "") + end + end +end +\stopluacode + +\startnotmode[no-timing] + \appendtoks\ctxlua{moduledata.progress.store()}\to\everystarttext + \appendtoks\ctxlua{moduledata.progress.store()}\to\everyshipout + \ctxlua{luatex.registerstopactions(function() moduledata.progress.save() end)} +\stopnotmode + +\permanent\protected\def\ShowNamedUsage#1#2#3% + {\setbox\scratchbox\vbox\bgroup + \startMPcode{doublefun} + begingroup ; save p, q, b, h, w ; + path p, q, b ; numeric h, w ; + p := \cldcontext{moduledata.progress.path("#1","#2")} ; + % p := p shifted -llcorner p ; + if bbwidth(p) > 0 : + h := 100 ; w := 2 * h ; + w := \the\textwidth-3pt ; % correct for pen + p := p xstretched w ; + b := boundingbox (llcorner p -- llcorner p shifted (w,h)) ; + pickup pencircle scaled 3pt ; linecap := butt ; + draw b withcolor \MPcolor{usage:frame} ; + draw p withcolor \MPcolor{usage:line} ; + if ("#3" <> "") and ("#3" <> "#2") : + q := \cldcontext{moduledata.progress.path("#1","#3")} ; + % q := q shifted -llcorner q ; + if bbwidth(q) > 1 : + q := q xstretched w ; + pickup pencircle scaled 1.5pt ; linecap := butt ; + draw q withcolor \MPcolor{usage:time} ; + fi ; + fi ; + fi ; + endgroup ; + \stopMPcode + \egroup + \scratchdimen\wd\scratchbox + \ifdim\scratchdimen>\zeropoint + \startlinecorrection[blank] + \box\scratchbox \endgraf + \hbox to \scratchdimen\bgroup + \tttf\strut\detokenize{#2}\hss + \scratchcounter =\cldcontext{moduledata.progress.set("#1","\detokenize{#2}")}\relax + \scratchcounterone =\cldcontext{moduledata.progress.bot("#1","\detokenize{#2}")}\relax + \scratchcountertwo =\cldcontext{moduledata.progress.top("#1","\detokenize{#2}")}\relax + \scratchcounterthree=\numexpr\scratchcountertwo-\scratchcounterone\relax + \ifnum\scratchcounter >\zerocount set:\the\scratchcounter \quad\fi + \ifnum\scratchcounterthree>\zerocount inc:\the\scratchcounterthree\quad\fi + \ifnum\scratchcounterone >\zerocount min:\the\scratchcounterone \quad\fi + \ifnum\scratchcountertwo >\zerocount max:\the\scratchcountertwo \quad\fi + pages:\cldcontext{moduledata.progress.pages("#1")}% + \egroup + \stoplinecorrection + \fi} + +\permanent\protected\def\LoadUsage #1{\ctxlua{moduledata.progress.convert("#1")}} +\permanent\protected\def\ShowUsage #1{\ctxlua{moduledata.progress.show("#1",".*", "variables: elapsed")}} +\permanent\protected\def\ShowMemoryUsage #1{\ctxlua{moduledata.progress.show("#1","memory:.*","variables: elapsed")}} +\permanent\protected\def\ShowNodeUsage #1{\ctxlua{moduledata.progress.show("#1","nodes:.*", "variables: elapsed")}} +\permanent\protected\def\ShowFilteredUsage#1#2{\ctxlua{moduledata.progress.show("#1","#2", "variables: elapsed")}} +\permanent\protected\def\ShowSimpleUsage #1#2{\ctxlua{moduledata.progress.show("#1","#2")}} + +\endinput diff --git a/Master/texmf-dist/tex/context/modules/mkiv/m-visual.mkiv b/Master/texmf-dist/tex/context/modules/mkiv/m-visual.mkiv index 6ec0a52b0af..8a49861cdbe 100644 --- a/Master/texmf-dist/tex/context/modules/mkiv/m-visual.mkiv +++ b/Master/texmf-dist/tex/context/modules/mkiv/m-visual.mkiv @@ -56,9 +56,7 @@ \unexpanded\def\fakelines#1#2% min max / 3 10 {\fakeparindent \scratchdimen\hsize - \ifindentation - \advance\scratchdimen -\parindent - \fi + \advance\scratchdimen -\parindent \fakerule\scratchdimen\break \getrandomcount\scratchcounter{\ifcase0#1 3\else#1\fi}{\ifcase0#2 10\else#2\fi}% \dorecurse\scratchcounter{\fakerule\hsize}% @@ -128,7 +126,7 @@ \unexpanded\def\fakeparindent {\noindent - \ifindentation + \ifzeropt\parindent\else \ifx\dofakedroppedcaps\relax {\fakeparindentcolor \vrule @@ -653,10 +651,10 @@ \appendtoks\dontshowwhatsits\to\everystoptext} \unexpanded\def\immediatewhatsit - {\bgroup\futurelet\next\doimmediatewhatsit} + {\bgroup\futurelet\nexttoken\doimmediatewhatsit} \unexpanded\def\doimmediatewhatsit - {\ifx\next\write + {\ifx\nexttoken\write \egroup\immediatewritetrue \else \egroup\expandafter\normalimmediate diff --git a/Master/texmf-dist/tex/context/modules/mkiv/s-article-titlepage.mkiv b/Master/texmf-dist/tex/context/modules/mkiv/s-article-titlepage.mkiv index abfb957c2fa..7579d421fa8 100644 --- a/Master/texmf-dist/tex/context/modules/mkiv/s-article-titlepage.mkiv +++ b/Master/texmf-dist/tex/context/modules/mkiv/s-article-titlepage.mkiv @@ -16,7 +16,7 @@ \unprotect % \startalignment[middle] -% \let\\=\par +% \enforced\let\\\par % \bfb % \setupinterlinespace % \documentvariable {subject} diff --git a/Master/texmf-dist/tex/context/modules/mkiv/s-fonts-coverage.mkiv b/Master/texmf-dist/tex/context/modules/mkiv/s-fonts-coverage.mkiv index 98a5c00a495..2d18708421b 100644 --- a/Master/texmf-dist/tex/context/modules/mkiv/s-fonts-coverage.mkiv +++ b/Master/texmf-dist/tex/context/modules/mkiv/s-fonts-coverage.mkiv @@ -100,7 +100,7 @@ % list = { % "cambria.ttc(Cambria Math)", % "xits-math.otf", - % -- "stixmath-regular.otf", + % -- "stixtwomath-regular.otf", -- watch out: the name changes % "latinmodern-math.otf", % -- "lucidabrightmathot.otf", % -- "lucidabrightmathot-demi.otf", diff --git a/Master/texmf-dist/tex/context/modules/mkiv/s-fonts-shapes.mkiv b/Master/texmf-dist/tex/context/modules/mkiv/s-fonts-shapes.mkiv index 90b9c1f6496..7dd39c07d0c 100644 --- a/Master/texmf-dist/tex/context/modules/mkiv/s-fonts-shapes.mkiv +++ b/Master/texmf-dist/tex/context/modules/mkiv/s-fonts-shapes.mkiv @@ -106,8 +106,8 @@ % \startTEXpage \ShowGlyphShape{simplenaskhi}{100bp}{0xF0299} \stopTEXpage % \startTEXpage \ShowGlyphShape{simplenaskhi}{100bp}{NameMe.1190} \stopTEXpage - \startTEXpage[offset=0pt]\ShowGlyphShape{file:stix2math.otf}{20bp}{0x1D44A}\stopTEXpage - \startTEXpage[offset=0pt]\ShowGlyphShape{file:stix2math.otf}{20bp}{0x1D44C}\stopTEXpage + \startTEXpage[offset=0pt]\ShowGlyphShape{file:stixtwomath-regular.otf}{20bp}{0x1D44A}\stopTEXpage + \startTEXpage[offset=0pt]\ShowGlyphShape{file:stixtwomath-regular.otf}{20bp}{0x1D44C}\stopTEXpage % \startTEXpage[offset=0pt]\ShowGlyphShape{name:cambria-math}{20bp}{0x00066}\stopTEXpage % \startTEXpage[offset=0pt]\ShowGlyphShape{name:cambria-math}{20bp}{0x1D453}\stopTEXpage diff --git a/Master/texmf-dist/tex/context/modules/mkiv/s-fonts-tables.lua b/Master/texmf-dist/tex/context/modules/mkiv/s-fonts-tables.lua index d9d7205dec1..8673ef398cc 100644 --- a/Master/texmf-dist/tex/context/modules/mkiv/s-fonts-tables.lua +++ b/Master/texmf-dist/tex/context/modules/mkiv/s-fonts-tables.lua @@ -27,6 +27,8 @@ local setlink = nodes.setlink local hpack = nodes.hpack local applyvisuals = nodes.applyvisuals +local lefttoright_code = nodes.dirvalues.lefttoright + local handle_positions = fonts.handlers.otf.datasetpositionprocessor local handle_injections = nodes.injections.handler @@ -285,17 +287,9 @@ function tabletracers.showpositionings(specification) if resources then - local direction = "TLT" - + local direction = lefttoright_code -- not that relevant probably local sequences = resources.sequences local marks = resources.marks - - if tonumber(direction) == -1 or direction == "TRT" then - direction = "TRT" - else - direction = "TLT" - end - local visuals = "fontkern,glyph,box" local datasets = fonts.handlers.otf.dataset(tfmdata,fontid,0) diff --git a/Master/texmf-dist/tex/context/modules/mkiv/s-fonts-variable.mkiv b/Master/texmf-dist/tex/context/modules/mkiv/s-fonts-variable.mkiv index 5336f602472..6e4b1773f0f 100644 --- a/Master/texmf-dist/tex/context/modules/mkiv/s-fonts-variable.mkiv +++ b/Master/texmf-dist/tex/context/modules/mkiv/s-fonts-variable.mkiv @@ -103,6 +103,12 @@ % \showfontvariations % [font=file:sourcecode-regular.otf] +% \showfontvariations +% [font=file:sourcecodevariable-roman.otf] + +% \showfontvariations +% [font=file:sourcecodevariable-italic.otf] + % \showfontvariations % [font=file:AmstelvarAlpha-VF.ttf] @@ -112,4 +118,14 @@ % \showfontvariations % [font=file:sitka.ttc] +% For Alan: + +% \usemodule[article-basic] +% \usemodule[fonts-variable] +% \starttext +% \showfontvariations[font=file:goldmansansitvf_wght.ttf] +% \showfontvariations[font=file:goldmansansvf_wght.ttf] +% \showfontvariations[font=file:goldmansanscdvf_wght.ttf] +% \stoptext + \stoptext diff --git a/Master/texmf-dist/tex/context/modules/mkiv/s-inf-01.mkvi b/Master/texmf-dist/tex/context/modules/mkiv/s-inf-01.mkvi index 67fc45d46fc..7cebfd9bb5f 100644 --- a/Master/texmf-dist/tex/context/modules/mkiv/s-inf-01.mkvi +++ b/Master/texmf-dist/tex/context/modules/mkiv/s-inf-01.mkvi @@ -31,7 +31,6 @@ local list = { } local size = { } local comp = { } - local used = setmetatableindex("table") local nope = setmetatableindex("number") local omit = { @@ -44,7 +43,7 @@ "colo%-pan.tex", ".*test.*" } local types = { - "tex", "mkii", "mkiv", "mkvi", "mkxl", "mklx", "lua", -- "mpiv" + "tex", "mkii", "mkiv", "mkvi", "lua", "mkxl", "mklx", "lmt" -- "mpiv" } local patterns = { "^([a-z][a-z][a-z][a-z])%-[a-z0-9%-]+%.[a-z]+", @@ -90,7 +89,7 @@ end local data = io.loaddata(name) if data then - if suffix == "lua" then + if suffix == "lua" or suffix == "lmt" then data = gsub(data,"%-%-%[%[.-%]%]%-%-","") data = gsub(data,"%-%-.-[\n\r]","") else @@ -120,15 +119,6 @@ for i=1,#types do collect(list,types[i],i) end - for category in next, list do - pattern ="{"..category.."%-" - for suffix, t in next, used do - local data = io.loaddata(resolvers.find_file("context."..suffix)) - if data and find(data,pattern) then - t[category] = true - end - end - end end local max, what = 0, (what == "size" and size) or list for k, v in table.sortedpairs(what) do @@ -141,9 +131,9 @@ function document.context_state_1(what) local max, what, norm = prepare(what) - context.starttabulate { "|Tl|T|T|T|T|T|T|T|" } + context.starttabulate { "|Tl|T|T|T|T|T|T|T|T|" } context.NC() - context(category) + context("category") context.NC() for i=1,#types do local n, m = 0, 0 @@ -156,20 +146,13 @@ context.Top(types[i],norm(max),n,m) context.NC() end - context.NC() + -- context.NC() context.NR() context.HL() for k, v in table.sortedpairs(what) do local c = what == size and comp[k] or nope context.NC() - context("\\bf %s~%s~~%s~~%s~~%s~~%s", - (used.mkii[k] and "ii") or "~~", - (used.mkiv[k] and "iv") or "~~", - (used.mkvi[k] and "vi") or "~~", - (used.mkiv[k] and "xl") or "~~", - (used.mkvi[k] and "lx") or "~~", - k - ) + context(k) context.NC() for i=1,#types do context.Bar(types[i],v[i],c[i],f_norm(norm(v[i]))) @@ -201,13 +184,14 @@ \definecolor[bar:mkxl][middlemagenta] \definecolor[bar:mklx][middlecyan] \definecolor[bar:lua] [middlegray] +\definecolor[bar:lmt] [middleorange] \newcount\UpCounter \starttexdefinition Top #what#fraction#total#bigones \hbox to 7em{\hss#total}% \enspace - \hbox {{\bf#what}\ifnum#total=#bigones\else~#bigones\rlap{~+}\fi\hss}% + \hbox to 4em{{{\bf#what}\ifnum#total=#bigones\else\ifnum#bigones>0~#bigones\rlap{~+}\fi\fi\hss}}% \stoptexdefinition \starttexdefinition Bar #color#size#nobigones#fraction @@ -215,6 +199,8 @@ \hbox to 7em{\hss\ifcase#nobigones\else\llap{-~}\fi#size}% \enspace \blackrule[color=bar:#color,width=#fraction\dimexpr 20em\relax,height=.8\strutht]% +% \quad +% \quad \fi \stoptexdefinition @@ -269,9 +255,9 @@ {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, mkxl, mklx, lua).} + {The relative number of files used in ConTeXt (tex, mkii, mkiv, mkvi, mkxl, mklx, lua, lmt).} {2}{number} \Show - {The relative size of files used in ConTeXt (tex, mkii, mkiv, mkvi, mkxl, mklx, lua).} + {The relative size of files used in ConTeXt (tex, mkii, mkiv, mkvi, mkxl, mklx, lua, lmt).} {2}{size} \stoptext diff --git a/Master/texmf-dist/tex/context/modules/mkiv/s-languages-hyphenation.lua b/Master/texmf-dist/tex/context/modules/mkiv/s-languages-hyphenation.lua index 65fd1ab1443..2ba265b5354 100644 --- a/Master/texmf-dist/tex/context/modules/mkiv/s-languages-hyphenation.lua +++ b/Master/texmf-dist/tex/context/modules/mkiv/s-languages-hyphenation.lua @@ -40,8 +40,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 getlanguage = nuts.getlanguage +local setlanguage = nuts.setlanguage local setlink = nuts.setlink local setdisc = nuts.setdisc local setfield = nuts.setfield @@ -63,10 +63,12 @@ local states = table.setmetatableindex(function(t,k) } end) +local currentlanguage = language.current or function() return tex.language end + interfaces.implement { name = "storelanguagestate", actions = function() - states[tex.language] = { + states[currentlanguage()] = { lefthyphenmin = tex.lefthyphenmin, righthyphenmin = tex.righthyphenmin, hyphenationmin = tex.hyphenationmin, @@ -128,17 +130,6 @@ local function mark(head,marked,w,h,d,how) end end -local function getlanguage(head,l,left,right) - local t = { } - for n in nextglyph, tonut(head) do - t[n] = { - getlang(n), - getfield(n,"left"), - getfield(n,"right"), - } - end -end - local langs = { } local tags = { } local noflanguages = 0 @@ -151,7 +142,7 @@ function moduledata.languages.hyphenation.showhyphens(head) -- somehow assigning -1 fails for n in nextglyph, tonut(head) do cached[n] = { - getlang(n), + getlanguage(n), getfield(n,"left"), getfield(n,"right") } @@ -164,7 +155,7 @@ function moduledata.languages.hyphenation.showhyphens(head) local lmin = s.lefthyphenmin local rmin = s.righthyphenmin for n in next, cached do - setlang(n,l) + setlanguage(n,l) setfield(n,"left",lmin) setfield(n,"right",rmin) end @@ -176,7 +167,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 - setlang(n,d[1]) + setlanguage(n,d[1]) setfield(n,"left",d[2]) setfield(n,"right",d[3]) end diff --git a/Master/texmf-dist/tex/context/modules/mkiv/s-magazine-basic.mkiv b/Master/texmf-dist/tex/context/modules/mkiv/s-magazine-basic.mkiv index d45fe6f601a..c5995162a4f 100644 --- a/Master/texmf-dist/tex/context/modules/mkiv/s-magazine-basic.mkiv +++ b/Master/texmf-dist/tex/context/modules/mkiv/s-magazine-basic.mkiv @@ -110,8 +110,9 @@ \doifoddpageelse { \reuseMPgraphic{rightpaper} } { - \reuseMPgraphic{leftpaper}} + \reuseMPgraphic{leftpaper} } + } \stopsetups @@ -459,8 +460,8 @@ \definetyping[xtyping] [style=\ttx] \definetyping[xxtyping][style=\ttxx] -\definetyping[ntyping] \setuptyping[ntyping][style=\narrowtt] -\definetype [ntype] \setuptype [ntype] [style=\narrowtt] +% \definetyping[ntyping] \setuptyping[ntyping][style=\narrowtt] +% \definetype [ntype] \setuptype [ntype] [style=\narrowtt] \setupdocument [main={\doifelsemode{atpragma}{This Way}{My Way}}, diff --git a/Master/texmf-dist/tex/context/modules/mkiv/s-maps.mkiv b/Master/texmf-dist/tex/context/modules/mkiv/s-maps.mkiv index af646b2e1ee..8775f565e5a 100644 --- a/Master/texmf-dist/tex/context/modules/mkiv/s-maps.mkiv +++ b/Master/texmf-dist/tex/context/modules/mkiv/s-maps.mkiv @@ -363,8 +363,8 @@ \def\doarticleheader {\startbaselinecorrection \bgroup - \hsize = 457pt - \let\\\crlf + \hsize= 457pt + \enforced\let\\\crlf \blank[35pt,force] \switchtobodyfont[24pt] \startalign[flushleft,verytolerant,extremestretch] @@ -419,7 +419,8 @@ \def\signArticle {\doifnothing {\MapsSkipFooter} - {\blank[line]\let\\\crlf + {\blank[line]% + \enforced\let\\\crlf \noindent\switchtobodyfont[ss,9pt]% \MapsAuthor \doifsomething{\MapsAddress}{\\\MapsAddress}% diff --git a/Master/texmf-dist/tex/context/modules/mkiv/s-module-basic.mkiv b/Master/texmf-dist/tex/context/modules/mkiv/s-module-basic.mkiv index 74621b2a3a8..7024cd91a0f 100644 --- a/Master/texmf-dist/tex/context/modules/mkiv/s-module-basic.mkiv +++ b/Master/texmf-dist/tex/context/modules/mkiv/s-module-basic.mkiv @@ -25,8 +25,6 @@ %D him when you run into problems. Bugs in this style can be sent to %D Hans. -\showframe - \usemodule[abbreviations-words] \startmodule[modules-basics] @@ -45,20 +43,24 @@ \let\module\setupdocument -\definepalet [module:unknown] [localone=black,localtwo=white] +\definepalet [module:unknown] [locallocalone=darkyellow,localtwo=darkred,localthree=white,localfour=darkgray] -\definepalet [module:tex] [localone=blue,localtwo=green] -\definepalet [module:mkii] [localone=blue,localtwo=green] -\definepalet [module:mkiv] [localone=blue,localtwo=green] -\definepalet [module:mkvi] [localone=blue,localtwo=green] +\definepalet [module:tex] [localone=darkblue,localtwo=darkgreen,localthree=white,localfour=darkgray] +\definepalet [module:mkii] [localone=darkblue,localtwo=darkgreen,localthree=white,localfour=darkgray] +\definepalet [module:mkiv] [localone=darkblue,localtwo=darkgreen,localthree=white,localfour=darkgray] +\definepalet [module:mkvi] [localone=darkblue,localtwo=darkgreen,localthree=white,localfour=darkgray] +\definepalet [module:mkxl] [localone=darkblue,localtwo=darkgreen,localthree=white,localfour=darkgray] +\definepalet [module:mklx] [localone=darkblue,localtwo=darkgreen,localthree=white,localfour=darkgray] -\definepalet [module:lua] [localone=red,localtwo=green] -\definepalet [module:cld] [localone=red,localtwo=green] +\definepalet [module:lua] [localone=darkred,localtwo=darkgreen,localthree=white,localfour=darkgray] +\definepalet [module:lmt] [localone=darkred,localtwo=darkgreen,localthree=white,localfour=darkgray] +\definepalet [module:cld] [localone=darkred,localtwo=darkgreen,localthree=white,localfour=darkgray] -\definepalet [module:mp] [localone=red,localtwo=blue] -\definepalet [module:mpii] [localone=red,localtwo=blue] -\definepalet [module:mpiv] [localone=red,localtwo=blue] -\definepalet [module:metapost][localone=red,localtwo=blue] +\definepalet [module:mp] [localone=darkred,localtwo=darkblue,localthree=white,localfour=darkgray] +\definepalet [module:mpii] [localone=darkred,localtwo=darkblue,localthree=white,localfour=darkgray] +\definepalet [module:mpiv] [localone=darkred,localtwo=darkblue,localthree=white,localfour=darkgray] +\definepalet [module:mpxl] [localone=darkred,localtwo=darkblue,localthree=white,localfour=darkgray] +\definepalet [module:metapost][localone=darkred,localtwo=darkblue,localthree=white,localfour=darkgray] \setuppalet [module:unknown] @@ -67,12 +69,10 @@ StartPage ; - color local_white ; local_white := .8white ; - color local_one ; local_one := \MPcolor{localone} randomized (.6,.8) ; - color local_two ; local_two := \MPcolor{localtwo} randomized (.3,.4) ; - - color local_one ; local_one := .75[\MPcolor{localone},white] ; - color local_two ; local_two := .75[\MPcolor{localtwo},white] ; + color local_one ; local_one := .6 * \MPcolor{localone} ; + color local_two ; local_two := .6 * \MPcolor{localtwo} ; + color local_three ; local_three := \MPcolor{localthree} ; + color local_four ; local_four := \MPcolor{localfour} ; numeric width ; width := bbwidth Page ; numeric height ; height := bbheight Page ; @@ -84,12 +84,13 @@ ddy := 0 ; sx := 60u ; for i=1 upto (4 randomized 2) : sy := 7u randomized 3u ; - fill unitsquare xyscaled(sx,sy) shifted (0,ddy) withcolor local_two ; + fill unitsquare xyscaled(sx,sy) shifted (0,ddy) + withcolor local_two ; ddy := ddy + sy + 4u ; endfor ; ) ; p := p shifted (dx,dy) shifted - center p ; - fill boundingbox p enlarged 8u withcolor local_white ; + fill boundingbox p enlarged 8u withcolor local_four ; fill boundingbox p enlarged 4u withcolor local_one ; draw p ; enddef ; @@ -111,7 +112,7 @@ draw anchored.urt(textext("\bf\strut\documentvariable{subtitle}") ysized 1.5cm,urcorner Page shifted (-1cm,-10cm)) ; draw anchored.urt(textext("\bf\strut\documentvariable{author}") ysized 1.5cm,lrcorner Page shifted (-1cm, 5cm)) ; draw anchored.urt(textext("\bf\strut\currentdate") ysized 1.5cm,lrcorner Page shifted (-1cm, 3cm)) ; - ) withcolor .25white ; + ) withcolor local_three ; StopPage ; diff --git a/Master/texmf-dist/tex/context/modules/mkiv/s-present-balls.mkiv b/Master/texmf-dist/tex/context/modules/mkiv/s-present-balls.mkiv index 6774b83407f..14b33f30389 100644 --- a/Master/texmf-dist/tex/context/modules/mkiv/s-present-balls.mkiv +++ b/Master/texmf-dist/tex/context/modules/mkiv/s-present-balls.mkiv @@ -156,7 +156,7 @@ \unexpanded\def\StartTitlePage {\startstandardmakeup \setupalign[middle] - \unexpanded\def\\{\vfil\bfb\setupinterlinespace} + \enforced\protected\def\\{\vfil\bfb\setupinterlinespace} \bfd\setupinterlinespace \vfil} diff --git a/Master/texmf-dist/tex/context/modules/mkiv/s-present-bars.mkiv b/Master/texmf-dist/tex/context/modules/mkiv/s-present-bars.mkiv index 13c09ff3b80..37f18ffca8d 100644 --- a/Master/texmf-dist/tex/context/modules/mkiv/s-present-bars.mkiv +++ b/Master/texmf-dist/tex/context/modules/mkiv/s-present-bars.mkiv @@ -68,7 +68,7 @@ \setupheadertexts [Breskens 2012] - [\getvariable{document}{title}] + [\documentvariable{title}] \setupbackgrounds [page] @@ -99,9 +99,9 @@ \startsetups document:setup - \doifsomething {\getvariable{document}{color}} { + \doifsomething {\documentvariable{color}} { - \definecolor[maincolor][\getvariable{document}{color}] + \definecolor[maincolor][\documentvariable{color}] } diff --git a/Master/texmf-dist/tex/context/modules/mkiv/s-present-boring.mkiv b/Master/texmf-dist/tex/context/modules/mkiv/s-present-boring.mkiv new file mode 100644 index 00000000000..334d6216d5d --- /dev/null +++ b/Master/texmf-dist/tex/context/modules/mkiv/s-present-boring.mkiv @@ -0,0 +1,143 @@ +%D \module +%D [ file=s-present-boring, % s-pre-15, +%D version=2020.07.10, +%D title=\CONTEXT\ Style File, +%D subtitle=Presentation Environment Boring, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +%D Because I use a mupdf based viewer and acrobat is not always reliable I nowadays +%D tend to go for simple presentation styles. They mostly serve as a reminder for +%D myself of what I'm supposed to talk about. Just demoing often makes more sense, +%D especially at meetings where there is some interaction. + +\startmodule[present-boring] + +\setupbodyfont + [plex] + +\setuppapersize + [S6] + +\setuplayout + [backspace=20pt, + topspace=20pt, + bottomspace=20pt, + header=0pt, + footer=0pt, + bottom=20pt, + bottomdistance=30pt, + width=middle, + height=fit] + +\definecolor[maincolor] [darkblue] +\definecolor[extracolor][darkyellow] +\definecolor[darkcolor] [darkgray] + +\setupbackgrounds + [page] + [backgroundoffset=10pt, + background=color, + backgroundcolor=darkcolor] + +\setupbackgrounds + [text] [text] + [backgroundoffset=10pt, + background=color, + backgroundcolor=maincolor] + +\setupbackgrounds + [bottom] [text] + [backgroundoffset=10pt, + background=color, + backgroundcolor=extracolor] + +\setupcolors + [textcolor=white] + +\setuphead + [chapter] + [style=\bfc, + after={\blank[line,fixed]}] + +\setupwhitespace + [halfline] + +\setupblank + [halfline,fixed] + +% \setupblank +% [fixed] + +\setuplinenumbering + [typing] + [style=\txx, + color=middlegray] + +\setuptyping + [numbering=line, + location=left, + blank=halfline] + +\startsetups document:start + + \startpagemakeup + \raggedcenter + \vfill + \dontleavehmode \scale [ + width=\textwidth + ] { + \space + {\bf \documentvariable{title}} + \space + } + \vfill + \dontleavehmode \scale [ + width=.8\textwidth + ] { + \space + {\bf \documentvariable{banner}} + \space + } + \vfill + \vfill + \dontleavehmode \scale [ + width=\textwidth + ] { + \qquad + \color[darkcolor]{\documentvariable{location}} + \qquad + } + \vfill + \stoppagemakeup + + \setupbottomtexts [ + { + \words { + \documentvariable{title} + \quad\emdash\quad + \documentvariable{location} + \quad\emdash\quad + \getmarking[title] + } + } + ] + +\stopsetups + +\startsetups document:stop + % +\stopsetups + +\stopmodule + +\continueifinputfile{s-present-boring.mkiv} + +\usemodule[present-common] + +\inputpresentationfile{context/2020/context-2020-tokens.tex} diff --git a/Master/texmf-dist/tex/context/modules/mkiv/s-present-colorful.mkiv b/Master/texmf-dist/tex/context/modules/mkiv/s-present-colorful.mkiv index ed4b5f7c487..f71a297d778 100644 --- a/Master/texmf-dist/tex/context/modules/mkiv/s-present-colorful.mkiv +++ b/Master/texmf-dist/tex/context/modules/mkiv/s-present-colorful.mkiv @@ -231,7 +231,7 @@ \bfd\setupinterlinespace \setupalign[middle] \vfil - \let\\=\vfil + \enforced\let\\\vfil \scale [factor=max]\bgroup \framed diff --git a/Master/texmf-dist/tex/context/modules/mkiv/s-present-funny.mkiv b/Master/texmf-dist/tex/context/modules/mkiv/s-present-funny.mkiv index 4948766adca..3788f94f037 100644 --- a/Master/texmf-dist/tex/context/modules/mkiv/s-present-funny.mkiv +++ b/Master/texmf-dist/tex/context/modules/mkiv/s-present-funny.mkiv @@ -190,7 +190,7 @@ \bfd\setupinterlinespace \setupalign[middle] \vfil - \def\\{\vfil\bfb\setupinterlinespace}} + \enforced\protected\def\\{\vfil\bfb\setupinterlinespace}} \unexpanded\def\StopTitlePage {\vfil\vfil\vfil diff --git a/Master/texmf-dist/tex/context/modules/mkiv/s-present-fuzzy.mkiv b/Master/texmf-dist/tex/context/modules/mkiv/s-present-fuzzy.mkiv index ee029b0e605..312cf1ce73e 100644 --- a/Master/texmf-dist/tex/context/modules/mkiv/s-present-fuzzy.mkiv +++ b/Master/texmf-dist/tex/context/modules/mkiv/s-present-fuzzy.mkiv @@ -125,7 +125,7 @@ \bfd\setupinterlinespace \setupalign[middle] \vfil - \let\\=\vfil} + \enforced\let\\\vfil} \unexpanded\def\StopTitlePage {\vfil\vfil\vfil diff --git a/Master/texmf-dist/tex/context/modules/mkiv/s-present-green.mkiv b/Master/texmf-dist/tex/context/modules/mkiv/s-present-green.mkiv index e62257ff383..5a57742576d 100644 --- a/Master/texmf-dist/tex/context/modules/mkiv/s-present-green.mkiv +++ b/Master/texmf-dist/tex/context/modules/mkiv/s-present-green.mkiv @@ -261,7 +261,7 @@ \bfd\setupinterlinespace \setupalign[middle] \vfil - \let\\=\vfil} + \enforced\let\\\vfil} \unexpanded\def\StopTitlePage {\vfil\vfil\vfil diff --git a/Master/texmf-dist/tex/context/modules/mkiv/s-present-organic.mkiv b/Master/texmf-dist/tex/context/modules/mkiv/s-present-organic.mkiv index 657b786f229..7994205a1ab 100644 --- a/Master/texmf-dist/tex/context/modules/mkiv/s-present-organic.mkiv +++ b/Master/texmf-dist/tex/context/modules/mkiv/s-present-organic.mkiv @@ -289,7 +289,7 @@ \unexpanded\def\StartTitlePage {\startstandardmakeup \switchtobodyfont[big] - \def\\{\vfill\bfb\let\\=\par} + \enforced\protected\def\\{\vfill\bfb\enforced\let\\\par}% \bfd\setupinterlinespace\gray \vskip.5cm\relax} diff --git a/Master/texmf-dist/tex/context/modules/mkiv/s-present-original.mkiv b/Master/texmf-dist/tex/context/modules/mkiv/s-present-original.mkiv index 1c5e94c8579..50cd6f9ba65 100644 --- a/Master/texmf-dist/tex/context/modules/mkiv/s-present-original.mkiv +++ b/Master/texmf-dist/tex/context/modules/mkiv/s-present-original.mkiv @@ -213,7 +213,7 @@ \setupinterlinespace \setupalign[middle] \vfil - \let\\=\vfil} + \enforced\let\\\vfil} \unexpanded\def\StopTitlePage {\vfil\vfil\vfil diff --git a/Master/texmf-dist/tex/context/modules/mkiv/s-present-split.mkiv b/Master/texmf-dist/tex/context/modules/mkiv/s-present-split.mkiv index 48be7ca8199..186075c58dc 100644 --- a/Master/texmf-dist/tex/context/modules/mkiv/s-present-split.mkiv +++ b/Master/texmf-dist/tex/context/modules/mkiv/s-present-split.mkiv @@ -154,7 +154,7 @@ \unexpanded\def\StartTitlePage {\startstandardmakeup \setupalign[middle] - \unexpanded\def\\{\vfil\bfb\setupinterlinespace} + \enforced\protected\def\\{\vfil\bfb\setupinterlinespace} \bfd\setupinterlinespace \vfil} diff --git a/Master/texmf-dist/tex/context/modules/mkiv/s-present-stack.mkiv b/Master/texmf-dist/tex/context/modules/mkiv/s-present-stack.mkiv index 4cc75404f2e..cda03ae1257 100644 --- a/Master/texmf-dist/tex/context/modules/mkiv/s-present-stack.mkiv +++ b/Master/texmf-dist/tex/context/modules/mkiv/s-present-stack.mkiv @@ -98,7 +98,7 @@ \unexpanded\def\TitlePage#1% {\startstandardmakeup \setupalign[middle] - \def\\{\vfil\bfb\setupinterlinespace} + \enforced\protected\def\\{\vfil\bfb\setupinterlinespace} \bfd\setupinterlinespace \vfil#1\vfil\vfil \stopstandardmakeup} diff --git a/Master/texmf-dist/tex/context/modules/mkiv/s-present-stepper.mkiv b/Master/texmf-dist/tex/context/modules/mkiv/s-present-stepper.mkiv index 3dd8d9dcd42..c2f3c018a51 100644 --- a/Master/texmf-dist/tex/context/modules/mkiv/s-present-stepper.mkiv +++ b/Master/texmf-dist/tex/context/modules/mkiv/s-present-stepper.mkiv @@ -189,7 +189,7 @@ {\setups[fonts:normalize] \resetsetups[fonts:normalize] \startstandardmakeup[headerstate=high] - \def\\{\def\\{\endgraf\quad\quad}\endgraf\quad\ignorespaces#2}% + \enforced\protected\def\\{\enforced\protected\def\\{\endgraf\quad\quad}\endgraf\quad\ignorespaces#2}% #1\setstrut\setupinterlinespace\vfil#3\vfil\vfil \stopstandardmakeup} diff --git a/Master/texmf-dist/tex/context/modules/mkiv/s-present-tiles.mkiv b/Master/texmf-dist/tex/context/modules/mkiv/s-present-tiles.mkiv index 566a610a4f9..900d8edc605 100644 --- a/Master/texmf-dist/tex/context/modules/mkiv/s-present-tiles.mkiv +++ b/Master/texmf-dist/tex/context/modules/mkiv/s-present-tiles.mkiv @@ -259,12 +259,12 @@ \switchtobodyfont[\measure{titlepagefont}] - \let\\=\crlf + \enforced\let\\\crlf \startalignment[flushleft] \bf \setupinterlinespace - \begstrut\getvariable{document}{title}\endstrut\par + \begstrut\documentvariable{title}\endstrut\par \stopalignment \vfill @@ -272,7 +272,7 @@ \startalignment[flushright] \bf \setupinterlinespace - \begstrut\getvariable{document}{subtitle}\endstrut\par + \begstrut\documentvariable{subtitle}\endstrut\par \stopalignment \stoptopicmakeup diff --git a/Master/texmf-dist/tex/context/modules/mkiv/s-present-weird.mkiv b/Master/texmf-dist/tex/context/modules/mkiv/s-present-weird.mkiv index 27ef7b2c26d..641c3d979c4 100644 --- a/Master/texmf-dist/tex/context/modules/mkiv/s-present-weird.mkiv +++ b/Master/texmf-dist/tex/context/modules/mkiv/s-present-weird.mkiv @@ -288,7 +288,7 @@ \starttexdefinition TitlePage #1 \begingroup - \def\\{\vskip1ex\bfc\def\\{\vskip1ex\bfb}} + \enforced\protected\def\\{\vskip1ex\bfc\def\\{\vskip1ex\bfb}} \enablemode[SpreadPage] \StartPage{#1} \StopPage diff --git a/Master/texmf-dist/tex/context/modules/mkiv/s-present-windows.mkiv b/Master/texmf-dist/tex/context/modules/mkiv/s-present-windows.mkiv index 22d6fdba15c..422e238016a 100644 --- a/Master/texmf-dist/tex/context/modules/mkiv/s-present-windows.mkiv +++ b/Master/texmf-dist/tex/context/modules/mkiv/s-present-windows.mkiv @@ -320,7 +320,7 @@ align=middle] \startSampleText[middle] \bfd\setupinterlinespace - \def\\{\bfb\setupinterlinespace\vfil\def\\{\vfil}}} + \enforced\protected\def\\{\bfb\setupinterlinespace\vfil\enforced\protected\def\\{\vfil}}} \unexpanded\def\StopTitlePage {\stopSampleText diff --git a/Master/texmf-dist/tex/context/modules/mkiv/s-references-show.mkiv b/Master/texmf-dist/tex/context/modules/mkiv/s-references-show.mkiv index 72cccce54f1..a693fbc4417 100644 --- a/Master/texmf-dist/tex/context/modules/mkiv/s-references-show.mkiv +++ b/Master/texmf-dist/tex/context/modules/mkiv/s-references-show.mkiv @@ -21,7 +21,7 @@ \enablehiddenbackground % trick -\edef\hiddenbackgroundlist{\hiddenbackgroundlist,trace-references} +\appendhiddenbackground{trace-references} \defineoverlay [trace-references] diff --git a/Master/texmf-dist/tex/context/modules/mkiv/s-syntax.mkiv b/Master/texmf-dist/tex/context/modules/mkiv/s-syntax.mkiv index d9492af3e54..658343ac560 100644 --- a/Master/texmf-dist/tex/context/modules/mkiv/s-syntax.mkiv +++ b/Master/texmf-dist/tex/context/modules/mkiv/s-syntax.mkiv @@ -42,49 +42,49 @@ \unexpanded\def\StartSyntax {\startlines % formatters - \let\Indent \module_syntax_Indent - \let\Sugar \module_syntax_Sugar - \let\Something \module_syntax_Something - \let\Lbrace \module_syntax_Lbrace - \let\Rbrace \module_syntax_Rbrace - \let\Lparent \module_syntax_Lparent - \let\Rparent \module_syntax_Rparent - \let\Lbracket \module_syntax_Lbracket - \let\Rbracket \module_syntax_Rbracket - \let\Or \module_syntax_Or - \let\Optional \module_syntax_Optional - \let\Means \module_syntax_Means - \let\Tex \module_syntax_Tex - \let\Literal \module_syntax_Literal - \let\Syntax \module_syntax_Syntax - \let\Next \module_syntax_Next - \let\Whatever \module_syntax_Whatever - \let\Quote \module_syntax_Quote - \let\Or \module_syntax_Or - \let\Means \module_syntax_Means - \let\FlaggedLiteral \module_syntax_FlaggedLiteral - \let\FlaggedSomething\module_syntax_FlaggedSomething + \enforced\let\Indent \module_syntax_Indent + \enforced\let\Sugar \module_syntax_Sugar + \enforced\let\Something \module_syntax_Something + \enforced\let\Lbrace \module_syntax_Lbrace + \enforced\let\Rbrace \module_syntax_Rbrace + \enforced\let\Lparent \module_syntax_Lparent + \enforced\let\Rparent \module_syntax_Rparent + \enforced\let\Lbracket \module_syntax_Lbracket + \enforced\let\Rbracket \module_syntax_Rbracket + \enforced\let\Or \module_syntax_Or + \enforced\let\Optional \module_syntax_Optional + \enforced\let\Means \module_syntax_Means + \enforced\let\Tex \module_syntax_Tex + \enforced\let\Literal \module_syntax_Literal + \enforced\let\Syntax \module_syntax_Syntax + \enforced\let\Next \module_syntax_Next + \enforced\let\Whatever \module_syntax_Whatever + \enforced\let\Quote \module_syntax_Quote + \enforced\let\Or \module_syntax_Or + \enforced\let\Means \module_syntax_Means + \enforced\let\FlaggedLiteral \module_syntax_FlaggedLiteral + \enforced\let\FlaggedSomething\module_syntax_FlaggedSomething % shortcuts - \let\FL \module_syntax_FlaggedLiteral - \let\FS \module_syntax_FlaggedSomething - \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 - \let\RB \module_syntax_Rbrace - \let\LP \module_syntax_Lparent - \let\RP \module_syntax_Rparent - \let\LS \module_syntax_Lbracket - \let\RS \module_syntax_Rbracket - \let\{ \module_syntax_Lbrace - \let\} \module_syntax_Rbrace - \let\( \module_syntax_Lparent - \let\) \module_syntax_Rparent - \let\[ \module_syntax_Lbracket - \let\] \module_syntax_Rbracket + \enforced\let\FL \module_syntax_FlaggedLiteral + \enforced\let\FS \module_syntax_FlaggedSomething + \enforced\let\L \module_syntax_Literal + \enforced\let\S \module_syntax_Something + \enforced\let\M \module_syntax_Means + \enforced\let\N \module_syntax_Next + \enforced\let\O \module_syntax_Or + \enforced\let\Q \module_syntax_Quote + \enforced\let\LB \module_syntax_Lbrace + \enforced\let\RB \module_syntax_Rbrace + \enforced\let\LP \module_syntax_Lparent + \enforced\let\RP \module_syntax_Rparent + \enforced\let\LS \module_syntax_Lbracket + \enforced\let\RS \module_syntax_Rbracket + \enforced\let\{ \module_syntax_Lbrace + \enforced\let\} \module_syntax_Rbrace + \enforced\let\( \module_syntax_Lparent + \enforced\let\) \module_syntax_Rparent + \enforced\let\[ \module_syntax_Lbracket + \enforced\let\] \module_syntax_Rbracket % precaution \catcode`\#\othercatcode} diff --git a/Master/texmf-dist/tex/context/modules/mkiv/s-system-macros.mkxl b/Master/texmf-dist/tex/context/modules/mkiv/s-system-macros.mkxl new file mode 100644 index 00000000000..0f26444037b --- /dev/null +++ b/Master/texmf-dist/tex/context/modules/mkiv/s-system-macros.mkxl @@ -0,0 +1,311 @@ +%D \module +%D [ file=s-system-tokens.mkxl, +%D version=2020.06.02, +%D title=\CONTEXT\ Style File, +%D subtitle=System Tokens Checking, +%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 file is for Wolfgang and Hans and it's used in the transition from \MKIV\ +%D to the more robust \LMTX. + +% todo: \permanent\protected\let\select\directselect : same value (add ref) +% +% todo: when mutable, remove immutable, decide on how immutable it really is +% +% todo: just for the fun of it we can compare the table generated here to mkiv but it +% needs the same hash exposure as we use in luametatex so i'll do that after all lmtx +% macros are checked (maybe i need to backport some more but it has a low priority) +% +% todo: do we need something similar for lua functions etc (problem: performance hit) +% +% todo: and how about metapost ... i need a mp.hashtokens in order to do that and I also +% need to think about protection there (tricky as we use an avl hash there) +% +% public undefined : SmallCaps scitebuffer sciteinlinebuffer +% single todos : \ \- \\ \_ + +\enablemode[texmacros] +\enablemode[metapostmacros] +% \enablemode[notmarked] +\enablemode[everything] + +\startmodule[system-macros] + +\continueifinputfile{s-system-macros.mkxl} + +% \usemodule[article-basic] \setuplayout[tight] \setupbodyfont[7pt,tt] +\usemodule[article-basic] \setuplayout[tight] \setupbodyfont[5pt,tt] + +\setupbackgrounds[page][background=color,backgroundcolor=darkgray] \setupcolors[textcolor=white] + +\setuppapersize + [A4,landscape] + [A4,landscape] + +\starttext + +\startluacode + + if tex.modes.texmacros then + + local context = context + local ctx_NC = context.NC + local ctx_NR = context.NR + local ctx_bold = context.bold + local ctx_verb = context.verbatim + + local find = string.find + local gsub = string.gsub + local create = token.create + + local crap = "[$>%|%&%#" .. string.char(0xEF) .. "]" + + local basefile = resolvers.findfile("context.mkxl") + local swapnames = { } + + local pattern = file.join(file.pathpart(basefile),"/*.mk*") + local filenames = dir.glob(pattern) + for i=1,#filenames do + swapnames[file.basename(filenames[i])] = true + end + + local pattern = file.join(file.pathpart(basefile),"/*.l**") + local filenames = dir.glob(pattern) + for i=1,#filenames do + swapnames[file.basename(filenames[i])] = true + end + + local hashnames = table.setmetatableindex(function(t,k) + local s = file.suffix(k) + local v = k + if s == "mkiv" then + local n = file.replacesuffix(k,"mkxl") + if swapnames[n] then + v = n + end + elseif s == "mkvi" then + local n = file.replacesuffix(k,"mklx") + if swapnames[n] then + v = n + end + elseif s == "lua" then + local n = file.replacesuffix(k,"lmt") + if swapnames[n] then + v = n + end + end + t[k] = v + return v + end) + + require("mtx-interface") + + local data = scripts.interface.editor("data") + local files = data and data.common and data.common.filenames or { } + local flagged = 0 + local total = 0 + local list = tex.hashtokens() + local all = not tex.modes.notmarked + local everything = tex.modes.everything + + table.sort(list) + + local function show(visible, check) + -- context.starttabulate { "|l|l|l|lj2|l|l|l|l|l|l|l|l|" } + context.starttabulate { "|l|l|l|lj2|l|l|l|l|l|l|l|l|" } + for i=1,#list do + local k = list[i] + if check(k) then + local v = create(k) + local mutable = v.mutable and "mutable" + local immutable = v.immutable and "immutable" + local frozen = v.frozen and "frozen" + local permanent = v.permanent and "permanent" + local primitive = v.primitive and "primitive" + local instance = v.instance and "instance" + local dealtwith = mutable or immutable or mutable or frozen or permanent or primitive -- beware: we can have combinations + local whatever = find(k,"^[a-z][a-z][a-z]+_") + local cscommand = gsub(v.cmdname or "","_"," ") + local undefined = cscommand == "undefined cs" + local marked = (dealtwith and "+") or (whatever and "-") or (instance and "!") + if everything or ((all or not marked) and not find(k,"^[pvm]_") and not find(k,"^![tT]")) then + local parameters = v.parameters + local noaligned = v.noaligned and "noaligned" + local filename = files[k] + local csname = context.escape(k) + if undefined then + marked = "?" + end + ctx_NC() if marked then context(marked) end + ctx_NC() if primitive then ctx_bold(csname) else + ctx_verb(csname) end + ctx_NC() if parameters then context(parameters > 0 and parameters or "-") end + ctx_NC() if undefined then context.red(false) end + context(cscommand) + ctx_NC() if primitive then context(primitive) end + ctx_NC() if permanent then context(permanent) end + ctx_NC() if immutable then context(immutable) end + ctx_NC() if frozen then context(frozen) end + ctx_NC() if mutable then context(mutable) end + ctx_NC() if instance then context(instance) end + ctx_NC() if noaligned then context(noaligned) end + ctx_NC() if filename then context(hashnames[filename]) end + ctx_NC() ctx_NR() + end + if visible then + total = total + 1 + if dealtwith then + flagged = flagged + 1 + end + end + end + end + context.stoptabulate() + end + + context.starttitle { title = "Public \\TEX\\ commands" } + show(true, function(k) return find(k,"^[a-zA-Z]+$") end) + context.stoptitle() + + context.starttitle { title = "Private \\TEX\\ commands" } + show(false, function(k) return not find(k,"^[a-zA-Z]+$") and not find(k,crap) end) + context.stoptitle() + + tokens.setters.macro("NumberOfVisible", total) + tokens.setters.macro("NumberOfFlagged", flagged) + + end + +\stopluacode + +\startmode[texmacros] + + \page + + \starttabulate[|c|l|] + \HL + \NC \type {+} \NC mutable, immutable, frozen, permanent, primitive \NC \NR + \NC \type {-} \NC protected by obscurity (underscores) \NC \NR + \NC \type {!} \NC instance (can be frozen) \NC \NR + \NC \type {0-9} \NC the number of arguments (argument grabbing can be delegated) \NC \NR + \HL + \stoptabulate + + \start \hsize 15cm \veryraggedright + Often frozen commands are redefined on demand and they can be overloaded. Mutable + doesn't mean that a user can change it without consequences, for instance the + \type {\current...} ones. Primitives come with the engine, permanent macros are + the core of \CONTEXT. Noaligned macros are special and dealt deep down when + scanning for alignment specific primitives. + \par \stop + + \starttabulate[||r|] + \BC number of visible macros \NC \NumberOfVisible \NC \NR + \BC number of flagged macros \NC \NumberOfFlagged \NC \NR + \stoptabulate + +\stopmode + +\page + +\startluacode + + if tex.modes.metapostmacros then + + local context = context + -- local ctx_NC = context.NC + -- local ctx_NR = context.NR + -- local ctx_bold = context.bold + + local find = string.find + local gsub = string.gsub + local create = token.create + + context.starttitle { title = "\\METAFUN\\ commands" } + + metapost.simple("prestine") + + local mptotal = 0 + local codes = metapost.codes + local types = metapost.types + local parameters = metapost.knownparameters + local procodes = mplib.propertycodes + local everything = tex.modes.everything + + context.startcolumns { n = 5, distance = "1em" } + context.nohyphens(false) + context.obeyspaces(false) + local t = metapost.gethashentries("prestine",true) -- prestine:1 + if t then + table.sort(t,function(a,b) return a[3] < b[3] end) + mptotal = #t + for i=1,mptotal do + local ti = t[i] + local code = codes[ti[1]] + local property = procodes[ti[2]] + local name = ti[3] + local vtype = ti[4] + local vardef = vtype and types[vtype] == "unsuffixedmacro" + context.bgroup() + -- context("%-15s\\quad",vardef and "(vardef) tag" or code) + context("%s %-15s\\quad",parameters[name] and "+" or "\\nbsp",vardef and "(vardef) tag" or code) + if property == "primitive" then + context.bf(false) + context.blue(false) + elseif property == "permanent" then + context.bf(false) + context.lightgreen(false) + elseif property == "immutable" then + context.bf(false) + context.lightcyan(false) + elseif property == "mutable" then + context.bf(false) + context.lightmagenta(false) + elseif everything or not find(name,"^%a+_") then + -- todo: + if vardef then + context.bf(false) + context.lightred(false) + end + end + context.verbatim(name) + context.egroup() + context.par() + end + end + context.stopcolumns() + + context.stoptitle() + + tokens.setters.macro("NumberOfMetafun", mptotal) + + end +\stopluacode + +\startmode [metapostmacros] + + \page + + \starttabulate[|c|l|] + \HL + \NC \type {-3} \NC \bf \lightmagenta mutable \NC \NR + \NC \type {1} \NC \bf \blue primitive \NC \NR + \NC \type {2} \NC \bf \lightgreen permanent \NC \NR + \NC \type {3} \NC \bf \lightcyan immutable \NC \NR + \NC \type {+} \NC \bf (also) used as key \NC \NR + \HL + \stoptabulate + + \starttabulate[||r|] + \BC number of metafun entries \NC \NumberOfMetafun \NC \NR + \stoptabulate + +\stopmode + +\stopmodule diff --git a/Master/texmf-dist/tex/context/modules/mkiv/s-system-tokens.mkxl b/Master/texmf-dist/tex/context/modules/mkiv/s-system-tokens.mkxl new file mode 100644 index 00000000000..b83a4f47b6c --- /dev/null +++ b/Master/texmf-dist/tex/context/modules/mkiv/s-system-tokens.mkxl @@ -0,0 +1,84 @@ +%D \module +%D [ file=s-system-tokens.mkxl, +%D version=2020.06.02, +%D title=\CONTEXT\ Style File, +%D subtitle=System Tokens Checking, +%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[system-tokens] + +\registerctxluafile{s-system-tokens}{} + +\permanent\protected\def\showsystemtokens{\ctxlua{moduledata.system.tokens.showlist()}} % can be public implementor + +\stopmodule + +\continueifinputfile{s-system-tokens.mkxl} + +\usemodule[article-basic] + +\setuppapersize[A4,landscape] + +\setuplayout[tight] + +\setupbodyfont[8pt] + +\starttext + + \showsystemtokens + + Some tokens cannot be created yet because they are more complex but eventually the creator will + deal with them. The indices are sometimes the same as internal but in most cases nicely start + at zero. When they start at another value, then there is an internal token or state that is not + user accessible. You always need to use symbolic constants as the numbers can change. + + The first column is a classifier (which is experimental and categories might change when we feel + the need). + + \startcolumns[n=5] + \starttabulate[|T||] + \NC 0 \NC unused \NC \NR + \NC 1 \NC regular \NC \NR + \NC 2 \NC character \NC \NR + \NC 3 \NC register \NC \NR + \NC 4 \NC internal \NC \NR + \NC 5 \NC reference \NC \NR + \NC 6 \NC data \NC \NR + \NC 7 \NC token \NC \NR + \NC 8 \NC node \NC \NR + \stoptabulate + \stopcolumns + + \page + + Here is a typeset table of \type {\startframed} using \type {\luatokentable\startframed}: + + \luatokentable\startframed + + which calls \type {\pack_framed_start_framed} where \type {\luatokentable\pack_framed_start_framed} gives: + + + \unprotect + \luatokentable\pack_framed_start_framed + \protect + + So you can guess what generates this: + + \unprotect + \luatokentable\pack_framed_start_framed_nop + \protect + + And this: + + \unprotect + \luatokentable\pack_framed_start_framed_yes + \protect + +\stoptext + diff --git a/Master/texmf-dist/tex/context/modules/mkiv/s-system-visual.mkiv b/Master/texmf-dist/tex/context/modules/mkiv/s-system-visual.mkiv new file mode 100644 index 00000000000..5b5107a2d12 --- /dev/null +++ b/Master/texmf-dist/tex/context/modules/mkiv/s-system-visual.mkiv @@ -0,0 +1,94 @@ +%D \module +%D [ file=s-system-visual.mkxl, +%D version=2020.07.15, +%D title=\CONTEXT\ Style File, +%D subtitle=System Visual Debugger Legend, +%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[system-visual] + +\starttexdefinition unexpanded visuallegend + \begingroup + \switchtobodyfont[10pt] + \setuptabulate[before=,after=] + \hsize24cm + \scale + [width=\textwidth] + \bgroup + \forgetall + \startboxedcolumns[n=3,strut=no] + \starttabulate[|lT|l|] + \NC L__ \NC line box \NC \NR + \NC H__ \NC horizontal box \NC \NR + \NC _T_ \NC vertical top box \NC \NR + \NC __V \NC vertical box \NC \NR + \TB + \NC VK \NC vertical kern \NC \NR + \NC HK \NC horizontal kern \NC \NR + \NC MK \NC math kern \NC \NR + \NC MK \NC margin kern \NC \NR + \NC LK \NC math list kern \NC \NR + \TB + \NC VP \NC vertical penalty \NC \NR + \NC HP \NC horizontal penalty \NC \NR + \TB + \NC LI \NC line skip \NC \NR + \NC BS \NC baseline skip \NC \NR + \NC PS \NC par skip \NC \NR + \NC DA \NC abovedisplay skip \NC \NR + \NC DB \NC belowdisplay skip \NC \NR + \NC SA \NC above display short skip \NC \NR + \NC SB \NC below display short skip \NC \NR + \NC TS \NC top skip \NC \NR + \NC ST \NC split top skip \NC \NR + \NC AS \NC tab skip \NC \NR + \NC LH \NC left hang skip \NC \NR + \NC RH \NC right hang skip \NC \NR + \NC MS \NC thin mu skip \NC \NR + \NC MM \NC med mu skip \NC \NR + \NC ML \NC thick mu skip \NC \NR + \NC IM \NC inter math skip \NC \NR + \NC MT \NC math skip \NC \NR + \NC LS \NC left skip \NC \NR + \NC RS \NC right skip \NC \NR + \NC SP \NC space skip \NC \NR + \NC XS \NC x space skip \NC \NR + \NC ZS \NC zero space skip \NC \NR + \NC PF \NC par fill skip \NC \NR + \NC IN \NC indent skip \NC \NR + \NC CS \NC correction skip \NC \NR + \NC VS \NC vertical user skip \NC \NR + \NC HS \NC horizontal user skip \NC \NR + \NC IC \NC italic correcection \NC \NR + \TB + \NC NL \NC leaders \NC \NR + \NC CL \NC c leaders \NC \NR + \NC XL \NC x leaders \NC \NR + \NC GL \NC g leaders \NC \NR + \TB + \NC M:B \NC math begin \NC \NR + \NC M:E \NC math end \NC \NR + \NC W:* \NC whatsit \NC \NR + \stoptabulate + \stopboxedcolumns + \egroup + \endgroup +\stoptexdefinition + +\stopmodule + +\continueifinputfile{s-system-visual.mkiv} + +\usemodule[article-basic] + +\startTEXpage[width=20cm,offset=5mm] + + \visuallegend + +\stopTEXpage diff --git a/Master/texmf-dist/tex/context/modules/mkiv/s-tugboat-columns.mkiv b/Master/texmf-dist/tex/context/modules/mkiv/s-tugboat-columns.mkiv index f8cace1e98e..317c5196ff4 100644 --- a/Master/texmf-dist/tex/context/modules/mkiv/s-tugboat-columns.mkiv +++ b/Master/texmf-dist/tex/context/modules/mkiv/s-tugboat-columns.mkiv @@ -320,7 +320,7 @@ \startsetups tugboat:introduction:article \start - \unexpanded\def\\{\unskip\space\&\space\ignorespaces} + \enforced\protected\def\\{\unskip\space\&\space\ignorespaces} \hbox{\indent\getvariable{tugboat}{author}} \par \stop @@ -333,14 +333,14 @@ \start \switchtobodyfont[12pt] - \def\\{\unskip\space\&\space\ignorespaces} + \enforced\protected\def\\{\unskip\space\&\space\ignorespaces} \getvariable{tugboat}{author} \par \stop \start \switchtobodyfont[9pt] - \unexpanded\def\\{\unskip,\space\ignorespaces} + \enforced\protected\def\\{\unskip,\space\ignorespaces} \getvariable{tugboat}{address} \par \start @@ -380,7 +380,7 @@ \hrule height .6pt \blank[halfline] \start - \let\\=\par + \enforced\let\\\par \start \bf \getvariable{tugboat}{title} @@ -393,7 +393,7 @@ \blank[line] \doiftext {\getbuffer[abstract]} { - \let\\=\endgraf + \enforced\let\\\endgraf \setups[tugboat:abstract:setup] \startsubject[title={Abstract}] \getbuffer[abstract] @@ -421,7 +421,7 @@ \start \switchtobodyfont[14.4pt] - \let\\=\par + \enforced\let\\\par \getvariable{tugboat}{title} \par \stop @@ -430,7 +430,7 @@ \blank[tugmedium] - \let\\=\par + \enforced\let\\\par \setups[tugboat:abstract:setup] @@ -458,7 +458,7 @@ \leftskip=\dimexpr\textwidth-\signaturewidth\relax - \let\\=\par + \enforced\let\\\par \dontleavehmode\llap { $\diamond$\enspace diff --git a/Master/texmf-dist/tex/context/modules/mkiv/s-tugboat.mkiv b/Master/texmf-dist/tex/context/modules/mkiv/s-tugboat.mkiv index e243dc4879b..14d751fcd53 100644 --- a/Master/texmf-dist/tex/context/modules/mkiv/s-tugboat.mkiv +++ b/Master/texmf-dist/tex/context/modules/mkiv/s-tugboat.mkiv @@ -393,7 +393,7 @@ % \blank[halfline] \start - \def\\{\unskip\space\&\space\ignorespaces} + \enforced\protected\def\\{\unskip\space\&\space\ignorespaces} \hbox{\indent\getvariable{tugboat}{author}} \par \stop @@ -431,7 +431,7 @@ \hrule height .6pt \blank[halfline] \start - \let\\=\par + \enforced\let\\\par {\bf\getvariable{tugboat}{title}} \par \blank[halfline] @@ -441,7 +441,7 @@ \blank[line] \doiftext {\getbuffer[abstract]} { - \let\\=\endgraf + \enforced\let\\\endgraf \setups{tugboat:abstract:setup} \subject{Abstract} \getbuffer[abstract] diff --git a/Master/texmf-dist/tex/context/modules/mkiv/x-math-svg.lua b/Master/texmf-dist/tex/context/modules/mkiv/x-math-svg.lua index 8a628816773..818c7ad8434 100644 --- a/Master/texmf-dist/tex/context/modules/mkiv/x-math-svg.lua +++ b/Master/texmf-dist/tex/context/modules/mkiv/x-math-svg.lua @@ -35,10 +35,10 @@ local pagedata = { } local statusname = "x-math-svg-status.lua" local pdfname = "x-math-svg.pdf" -local pdftosvg = os.which("mudraw") +local pdftosvg = os.which("mutool") local f_make_tex = formatters[ [[context --global kpse:x-math-svg.mkvi --inputfile="%s" --svgstyle="%s" --batch --noconsole --once --purgeall]] ] -local f_make_svg = formatters[ [[mudraw -o "math-%%d.svg" "%s" 1-9999]] ] +local f_make_svg = formatters[ [[mutool draw -o "math-%%d.svg" "%s" 1-9999]] ] ----- f_inline = formatters[ [[
]] ] local f_inline = formatters[ [[
]] ] @@ -101,7 +101,7 @@ function svgmath.convert(filename,svgstyle) -- invalid filename return false, "invalid filename" elseif not pdftosvg then - return false, "mudraw is not installed" + return false, "mutool is not installed" end os.execute(f_make_tex(filename,svgstyle)) diff --git a/Master/texmf-dist/tex/context/modules/mkiv/x-mathml-basics.mkiv b/Master/texmf-dist/tex/context/modules/mkiv/x-mathml-basics.mkiv index e166995b0c8..bb119f5144f 100644 --- a/Master/texmf-dist/tex/context/modules/mkiv/x-mathml-basics.mkiv +++ b/Master/texmf-dist/tex/context/modules/mkiv/x-mathml-basics.mkiv @@ -6,7 +6,7 @@ % this can become a core helper -% bwe could do all of them in lua +% we could do all of them in lua \startluacode local find = string.find @@ -87,11 +87,11 @@ end } \stoptexdefinition -\starttexdefinition mtext #1 - \text { - #1 - } -\stoptexdefinition +% \starttexdefinition mtext #1 +% \text { +% #1 +% } +% \stoptexdefinition % mover diff --git a/Master/texmf-dist/tex/context/modules/mkiv/x-mathml.mkiv b/Master/texmf-dist/tex/context/modules/mkiv/x-mathml.mkiv index adc49431407..bd55196f9d3 100644 --- a/Master/texmf-dist/tex/context/modules/mkiv/x-mathml.mkiv +++ b/Master/texmf-dist/tex/context/modules/mkiv/x-mathml.mkiv @@ -1890,8 +1890,6 @@ \fi \stoptexdefinition -\newsignal\mmltextsignal % not used - \starttexdefinition applymmlsometext #1#2 \applymmlmathbackground {#1} { \applymmlmathcolor {#1} { diff --git a/Master/texmf-dist/tex/context/modules/mkiv/x-setups-basics.mkiv b/Master/texmf-dist/tex/context/modules/mkiv/x-setups-basics.mkiv index 4e960f4287c..67912b8d76f 100644 --- a/Master/texmf-dist/tex/context/modules/mkiv/x-setups-basics.mkiv +++ b/Master/texmf-dist/tex/context/modules/mkiv/x-setups-basics.mkiv @@ -90,7 +90,9 @@ \pushmacro\setuptext -\defineframedtext +\ifcase\contextlmtxmode \else \pushoverloadmode \let\setuptext\setuptext \popoverloadmode \fi + +\defineframedtext % todo commands=no [setuptext] [\c!width=\hsize, \c!height=\v!fit, @@ -492,9 +494,15 @@ \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\setup {\c_cmd_kind\plustwo \cmd_show_setup} \unexpanded\def\showsetup {\c_cmd_kind\plustwo \cmd_show_setup} +\ifcase\contextlmtxmode \else + \pushoverloadmode + \unexpanded\def\setup{\c_cmd_kind\plustwo\cmd_show_setup} + \popoverloadmode +\fi + \unexpanded\def\showsetupinlist#1#2#3% {%(#1)(#2)(#3)\par \edef\m_cmd_instance{\secondoftwoarguments#3}% diff --git a/Master/texmf-dist/tex/context/modules/mkxl/s-characters-combinations.lmt b/Master/texmf-dist/tex/context/modules/mkxl/s-characters-combinations.lmt new file mode 100644 index 00000000000..be318eb38bf --- /dev/null +++ b/Master/texmf-dist/tex/context/modules/mkxl/s-characters-combinations.lmt @@ -0,0 +1,30 @@ +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.combinations = moduledata.characters.combinations or { } + +local context = context +local ctx_NC = context.NC +local ctx_NR = context.NR +local ctx_MR = context.MR +local ctx_ML = context.ML + +function moduledata.characters.combinations.showcombinations(settings) + context.starttabulate { "|l|T|cTw(1em)|T|" } + for k, v in table.sortedhash(characters.verbosemarks) do + local m = "with" .. string.gsub(k," ","") + ctx_NC() context(k) + ctx_NC() context("%U",v) + ctx_NC() context("%s",v) + ctx_NC() if token.is_defined(m) then context("\\string\\%s",m) end + ctx_NC() ctx_NR() + end + context.stoptabulate() +end + diff --git a/Master/texmf-dist/tex/context/modules/mkxl/s-characters-combinations.mkxl b/Master/texmf-dist/tex/context/modules/mkxl/s-characters-combinations.mkxl new file mode 100644 index 00000000000..aef466f8484 --- /dev/null +++ b/Master/texmf-dist/tex/context/modules/mkxl/s-characters-combinations.mkxl @@ -0,0 +1,61 @@ +%D \module +%D [ file=s-characters-combinations, +%D version=2021.02.08 +%D title=\CONTEXT\ Style File, +%D subtitle=Character combinations, +%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-combinations] + +\registerctxluafile{s-characters-combinations}{autosuffix} + +\installmodulecommandluasingle \showcharactercombinations {moduledata.characters.combinations.showcombinations} + +\stopmodule + +\continueifinputfile{s-characters-combinations.mkxl} + +\usemodule[art-01] + +\setupbodyfont[dejavu] + +\starttext + + \showcharactercombinations + + \page + + \startlines + \chr {a acute } á \withacute a + \chr {o double acute } ő \withdoubleacute o + \chr {a grave } à \withgrave a + \chr {o double grave } ȍ \withdoublegrave o + \chr {a circumflex } â \withcircumflex a + \chr {e circumflex below} ḙ \withcircumflexbelow e + \chr {a diaeresis } ä \withdiaeresis a + \chr {a tilde } ã \withtilde a + \chr {i tilde below } ḭ \withtildebelow i + \chr {a macron } ā \withmacron a + \chr {k line below } ḵ \withlinebelow k + \chr {c cedilla } ç \withcedilla c + \chr {s comma below } ş \withcommabelow s + \chr {z hook below } ȥ \withhookbelow z + \chr {a hook } ả \withhook a + \chr {a ring } å \withring a + \chr {a ring below } ḁ \withringbelow a + \chr {m dot } ṁ \withdot m + \chr {l middle dot } ŀ \withmiddledot l + \chr {m dot below } ṃ \withdotbelow m + \chr {a breve } ă \withbreve a + \chr {a inverted breve } ȃ \withinvertedbreve a + \chr {k caron } ǩ \withcaron k + \chr {o stroke } ø \withstroke o + \stoplines + +\stoptext diff --git a/Master/texmf-dist/tex/context/modules/mkxl/s-colors-show.mkxl b/Master/texmf-dist/tex/context/modules/mkxl/s-colors-show.mkxl new file mode 100644 index 00000000000..aa0e3227eb6 --- /dev/null +++ b/Master/texmf-dist/tex/context/modules/mkxl/s-colors-show.mkxl @@ -0,0 +1,276 @@ +%D \module +%D [ file=colo-run, +%D version=1997.04.01, +%D title=\CONTEXT\ Color Macros, +%D subtitle=Runtime loaded commands, +%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. + +\registerctxluafile{colo-run}{} + +\unprotect + +%D Colors + +%D These are nicer in \LUA\ code than in \TEX\ code but not more efficient. + +\permanent\protected\gdef\showcolorbar[#1]% + {\backgroundline[#1]{\strut\enspace\color[white]{white}\enspace\color[black]{black}\enspace}} + +\permanent\protected\tolerant\gdef\showcolorset[#1]% + {\ctxcommand{showcolorset("#1")}} + +\permanent\protected\tolerant\gdef\showcolorcomponents[#1]% + {\ctxcommand{showcolorcomponents("#1")}} + +\permanent\protected\tolerant\gdef\showcolor[#1]% + {\ifparameter#1\or + \usecolors [#1]% delayed and we can only ask for the set if + \showcolorset[#1]% loading has happened + \fi} + +%D The rest might also be done in \LUA\ although there is not much beauty to gain +%D here (too much typesetting specific). Also, these macros are pretty old and +%D hardly used so best keep them as they are. But we keep them because they always +%D worked and it doesn't hurt to see some \MKII|-|code every now and then. + +%D Palets + +\permanent\protected\tolerant\gdef\showpalet[#1]#*[#2]% + {\doifelsecolorpalet{#1} + {\doifelseinset\v!vertical{#2}\colo_palets_show_vertical\colo_palets_show_horizontal{#1}{#2}}% + {}} + +\gdef\colo_palets_show_vertical#1#2% + {\begingroup + \forgetall + \setlocalhsize + \hsize\localhsize + \offinterlineskip + \setuppalet[#1] + \tabskip\zeropoint + \def\colo_palets_show_palet##1% + {\doifelseinset\v!number{#2}{##1\hskip.5\emwidth}{}% + \aligntab + \color [##1]{\vrule\s!width3\emwidth\s!height\strutht\s!depth\strutdp}% + \graycolor[##1]{\vrule\s!width3\emwidth\s!height\strutht\s!depth\strutdp}% + \aligntab + \doifinset\v!value{#2}{\hskip.5\emwidth\colorvalue{##1}}% + \crcr} + \halign + {\hss\alignmark\alignmark\aligntab\hss\alignmark\alignmark\hss\aligntab\alignmark\alignmark\cr + \aligntab\doifinset\v!name{#2}{\strut#1}\aligntab\cr + \colo_palets_process[#1]\colo_palets_show_palet\crcr}% + \endgroup} + +\gdef\colo_palets_show_horizontal#1#2% todo: bTABLE etc + {\vbox + {\forgetall + \setlocalhsize + \hsize\localhsize + \offinterlineskip + \setuppalet[#1] + \tabskip\zeropoint + \scratchwidth\zeropoint + \doifinset\v!number{#2} + {\def\colo_palets_show_palet##1% + {\setbox\scratchbox\hbox{##1}% + \ifdim\scratchwidth<\wd\scratchbox + \scratchwidth\wd\scratchbox + \fi}% + \colo_palets_process[#1]\colo_palets_show_palet}% + \advance\scratchwidth\emwidth + \ifdim\scratchwidth<5\emwidth + \scratchwidth5\emwidth + \fi + \halign + {\alignmark\alignmark\aligntab\aligntab\hbox to \scratchwidth{\hss\alignmark\alignmark\hss}\cr + \doifinset\v!number{#2} + {\def\colo_palets_show_palet##1{\aligntab\strut##1}% + \colo_palets_process[#1]\colo_palets_show_palet}\cr + \doifinset\v!name{#2}{#1\hskip.5\emwidth}% + \def\colo_palets_show_palet##1% + {\aligntab\strut\color[##1]{\vrule\s!width\scratchwidth\s!height\strutht\s!depth\zeropoint}}% + \colo_palets_process[#1]\colo_palets_show_palet\crcr + \noalign{\vskip-\strutdepth}% + \def\colo_palets_show_palet##1% + {\aligntab\graycolor[##1]{\vrule\s!width\scratchwidth\s!height\zeropoint\s!depth\strutdp}}% + \colo_palets_process[#1]\colo_palets_show_palet\crcr + \doifinset\v!value{#2} + {\def\colo_palets_show_palet##1% + {\aligntab\vbox + {\hsize\scratchwidth + \vskip.25\exheight + \everypar{\strut} + \veryraggedcenter + \let\colorformatseparator\endgraf + \colorvalue{##1}}}% + \colo_palets_process[#1]\colo_palets_show_palet}% + \crcr}}} + +\gdef\colo_palets_process[#1]% + {\getpaletlist[#1]% + \normalexpanded{\globalprocesscommalist[\paletlist]}} + +\permanent\protected\tolerant\gdef\comparepalet[#1]% + {\doifelsecolorpalet{#1}% + {\hbox + {\colo_palets_compare_indeed\color{#1}% + \quad + \colo_palets_compare_indeed\graycolor{#1}}}% + {}} + +\gdef\colo_palets_compare_indeed#1#2% + {\vbox + {\forgetall + \setlocalhsize + \hsize\localhsize + \offinterlineskip + \setuppalet[#2] + \getpaletsize[#2]% + \getpaletlist[#2]% + \scratchwidth2\emwidth\relax + \hsize\paletsize\scratchwidth + \def\colo_palets_compare##1% + {\hbox + {\setbox0\hbox + {#1[##1]{\vrule\s!width\hsize\s!height3ex}}% + \wd0\zeropoint + \box0 + \hbox to \hsize + {\def\colo_palets_compare####1% + {\hbox to \scratchwidth + {\hss#1[####1]{\vrule\s!width.5\scratchwidth\s!height2.25\exheight\s!depth-.75\exheight}\hss}}% + \processcommacommand[\paletlist]\colo_palets_compare}} + \endgraf} + \processcommacommand[\paletlist]\colo_palets_compare}} + +%D Groups + +\permanent\protected\tolerant\gdef\showcolorgroup[#1]#*[#2]% + {\doifcolor{#1:1} + {\doifelseinset\v!vertical{#2}\colo_groups_show_vertical\colo_groups_show_horizontal{#1}{#2}}} + +\gdef\colo_groups_show_horizontal#1#2% + {\vbox + {\forgetall + \setlocalhsize + \hsize\localhsize + \offinterlineskip + \setuppalet + \tabskip\zeropoint + \def\colorformatseparator{\strut\cr} + \def\colo_groups_show_group##1% + {\doifcolor{#1:##1}{\vbox + {\halign + {\hss\alignmark\alignmark\alignmark\alignmark\hss\cr + \doifinset\v!number{#2}{\strut##1}\cr + \color [#1:##1]{\vrule\s!width4\emwidth\s!height\strutht \s!depth\zeropoint}\cr + \graycolor[#1:##1]{\vrule\s!width4\emwidth\s!height\zeropoint\s!depth\strutdp }\cr + \doifinset\v!value{#2}{\colorvalue{#1:##1}\strut}\crcr}}}}% + \hbox + {\doifinset\v!name{#2} + {\strut + \doifelseinset\v!value{#2} + {\raise3\lineheight\hbox{#1\hskip.5\emwidth}} + {#1}% + \hskip.5\emwidth}% + \colo_groups_show_group1\colo_groups_show_group2\colo_groups_show_group3\colo_groups_show_group4% + \colo_groups_show_group5\colo_groups_show_group6\colo_groups_show_group7\colo_groups_show_group8}}} + +\gdef\colo_groups_show_vertical#1#2% + {\vbox + {\forgetall + \setlocalhsize + \hsize\localhsize + \offinterlineskip + \setuppalet + \tabskip\zeropoint + \def\colo_groups_show_group##1% + {\doifcolor{#1:##1} + {\doifinset\v!number{#2} + {##1\hskip.5\emwidth}% + \aligntab + \color [#1:##1]{\vrule\s!width2.5\emwidth\s!height\strutht\s!depth\strutdp}% + \graycolor[#1:##1]{\vrule\s!width2.5\emwidth\s!height\strutht\s!depth\strutdp} + \aligntab + \doifinset\v!value{#2}{\hskip.5\emwidth\colorvalue{#1:##1}}% + \crcr}}% + \halign + {\hss\alignmark\alignmark\aligntab\hss\alignmark\alignmark\hss\aligntab\alignmark\alignmark\hss\cr + \aligntab\doifinset\v!name{#2}{\strut#1}\aligntab\crcr + \colo_groups_show_group1\colo_groups_show_group2\colo_groups_show_group3\colo_groups_show_group4% + \colo_groups_show_group5\colo_groups_show_group6\colo_groups_show_group7\colo_groups_show_group8}}} + +\permanent\protected\tolerant\gdef\comparecolorgroup[#1]% + {\doifcolor{#1:1} + {\hbox + {\colo_groups_compare_indeed\color {#1}\quad + \colo_groups_compare_indeed\graycolor{#1}}}} + +\gdef\colo_groups_compare_indeed#1#2% + {\vbox + {\forgetall + \setlocalhsize + \hsize\localhsize + \scratchcounter\zerocount + \dorecurse{15}{\doifcolor{#2:\recurselevel}{\advance\scratchcounter\plusone}} + \scratchwidth2\emwidth\relax + \hsize\scratchcounter\scratchwidth + \dorecurse\scratchcounter{\colo_groups_compare_step{#1}{#2}\recurselevel}}} + +\def\colo_groups_compare_step#1#2#3% + {\hbox to \hsize + {\setbox\scratchbox\hbox + {#1[#2:#3]{\vrule\s!width\hsize\s!height3\exheight}}% + \wd\scratchbox\zeropoint + \box\scratchbox + \hbox to \hsize + {\hss + \dorecurse\scratchcounter + {#1[#2:\recurselevel]{\vrule\s!width.5\scratchwidth\s!height2.25\exheight\s!depth-.75\exheight}% + \hss}}} + \endgraf} + +\protect + +\continueifinputfile{s-colors-show.mkxl} + +\setupwhitespace[big] + +\usecolors[dem] + +\starttext + +\startsubject[title=\type{\showpalet}] + \showpalet [alfa] [horizontal,name,number,value] +\stopsubject + +\startsubject[title=\type{\showcolorcomponents}] + \showcolorcomponents[red,green,blue] +\stopsubject + +\startsubject[title=\type{\comparepalet}] + \comparepalet[alfa] +\stopsubject + +\startsubject[title=\type{\showcolor}] + \showcolor[rgb] +\stopsubject + +\startsubject[title=\type{\showcolorgroup}] + \showcolorgroup[magenta] + \showcolorgroup[cyan] + \showcolorgroup[yellow] +\stopsubject + +\startsubject[title=\type{\comparecolorgroup}] + \comparecolorgroup[magenta] +\stopsubject + +\stoptext diff --git a/Master/texmf-dist/tex/context/modules/mkxl/s-fonts-show.mkxl b/Master/texmf-dist/tex/context/modules/mkxl/s-fonts-show.mkxl new file mode 100644 index 00000000000..42b5af125f7 --- /dev/null +++ b/Master/texmf-dist/tex/context/modules/mkxl/s-fonts-show.mkxl @@ -0,0 +1,658 @@ +%D \module +%D [ file=font-run, +%D version=1998.09.11, % (second) +%D version=2001.02.20, % (third) +%D title=\CONTEXT\ Font Macros, +%D subtitle=Runtime Macros, +%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 code is hooked into the core macros and saves some format +%D space. It needs a cleanup as it's real old derioved \MKII\ code] +%D +%D Better use \type{\bTABLE...\eTABLE}. + +\unprotect + +\gdef\module_fonts_show_prepare#1% + {\iftok{#1}\emptytoks + \edef\m_module_fonts_show_title{\the\bodyfontsize}% + \else + \switchtobodyfont[#1]% + \edef\m_module_fonts_show_title{#1}% + \fi + \ifempty\fontclass + \edef\m_module_fonts_show_title{[\m_module_fonts_show_title]}% + \orelse\ifx\fontclass\m_module_fonts_show_title + \edef\m_module_fonts_show_title{[\m_module_fonts_show_title]}% + \else + \edef\m_module_fonts_show_title{[\fontclass]\space[\m_module_fonts_show_title]}% + \fi} + +\permanent\protected\tolerant\gdef\showbodyfont[#1]% + {\ifinsidefloat\else\startbaselinecorrection\fi + \vbox + {\module_fonts_show_prepare{#1}% + \def\next##1##2##3##4% + {\bTR + \bTD{##4}\type{##1}\eTD + \bTD{##4}##1##3{\tf ##2}\eTD + \bTD{##4}##1##3{\tf ##2}\eTD + \bTD{##4}##1##3{\bf ##2}\eTD + \bTD{##4}##1##3{\sl ##2}\eTD + \bTD{##4}##1##3{\it ##2}\eTD + \bTD{##4}##1##3{\bs ##2}\eTD + \bTD{##4}##1##3{\bi ##2}\eTD + \bTD{##4}##1##3{\tfx ##2}\eTD + \bTD{##4}##1##3{\tfxx ##2}\eTD + \bTD{##4}##1##3{\tfa ##2}\eTD + \bTD{##4}##1##3{\tfb ##2}\eTD + \bTD{##4}##1##3{\tfc ##2}\eTD + \bTD{##4}##1##3{\tfd ##2}\eTD + \eTR}% + \bTABLE[\c!align=\v!middle,\c!loffset=.5ex,\c!roffset=.5ex] + \bTR\bTD[\c!nx=14,\c!offset=1ex]\tttf{\m_module_fonts_show_title}\eTD\eTR + \next{}{}\type{}% + \next\rm{\languageparameter\c!text}\relax{\tfd\setstrut\strut}% + \next\ss{\languageparameter\c!text}\relax{\tfd\setstrut\strut}% + \next\tt{\languageparameter\c!text}\relax{\tfd\setstrut\strut}% + \next\mr{\languageparameter\c!text}\mathematics{\tfd\setstrut\strut}% + \eTABLE}% + \ifinsidefloat\else\stopbaselinecorrection\fi} + +\permanent\protected\tolerant\gdef\showbodyfontenvironment[#1]% + {\ifinsidefloat\else\startbaselinecorrection\fi + \vbox + {\module_fonts_show_prepare{#1}% + \def\next##1##2% + {\bTR + \bTD##1\bodyfontsizevariable{##2}\s!text\eTD + \bTD##1\bodyfontsizevariable{##2}\s!script\eTD + \bTD##1\bodyfontsizevariable{##2}\s!scriptscript\eTD + \bTD##1\bodyfontsizevariable{##2}\s!x\eTD + \bTD##1\bodyfontsizevariable{##2}\s!xx\eTD + \bTD##1\bodyfontsizevariable{##2}\v!small\eTD + \bTD##1\bodyfontsizevariable{##2}\v!big\eTD + %\bTD##1\bodyfontsizevariable{##2}\c!interlinespace\eTD + \eTR}% + \def\nextone{\next\relax}% + \bTABLE[\c!align=\v!middle,\c!loffset=.5ex,\c!roffset=.5ex] + \bTR\bTD[\c!nx=7,\c!offset=1ex]\tttf{\m_module_fonts_show_title}\eTD\eTR + \next{\tttf\thirdofthreearguments}\relax + \processbodyfontenvironmentlist{nextone} + \eTABLE}% + \ifinsidefloat\else\stopbaselinecorrection\fi} + +\permanent\protected\tolerant\gdef\showfont[#1]#*[#2]% + {\bgroup + \iftok{#1}\emptytoks\else + \definedfont[#1]% + \ifdim40\emwidth>\hsize + \glyphscale750\relax + \fi + \fi + \integerdef\c_module_fonts_font_id\fontid\font + \doifelsenothing{#2} + {\module_fonts_show_font_indeed{#1}\zerocount} + {\doifelse{#2}\v!all + {\dostepwiserecurse\zerocount{255}\plusone + {\scratchcounterone \recurselevel + \scratchcountertwo \numexpr\scratchcounterone*256\relax + \scratchcounterthree\numexpr\scratchcountertwo+255\relax + \doloop + {\iffontchar\font\scratchcountertwo + \module_fonts_show_font_indeed{#1}\scratchcounterone + \exitloop + \orelse\ifnum\scratchcountertwo=\scratchcounterthree + \exitloop + \else + \advance\scratchcountertwo\plusone + \fi}}} + {\processcommalist[#2]{\module_fonts_show_font_indeed{#1}}}}% + \egroup} + +\gdef\module_fonts_show_font_indeed#1#2% made some 50% faster but still slow + {\bgroup + \ifinsidefloat\else\startbaselinecorrection\fi + \vbox\bgroup + \scratchdimenone 2.5\emwidth + \scratchdimentwo 2.4\emwidth + \scratchdimenthree2.3\emwidth + \scratchcounterfour#2\relax + \forgetall + \startoverlay % easier in cld + {\vbox + {\tf + \setstrut + \setfontid\c_module_fonts_font_id + \offinterlineskip + \unexpanded\def\wrapbox##1% + {\vpack to \scratchdimenone + {\vss + \hpack to \scratchdimenone + {\setfontid\c_module_fonts_font_id + \ifzeropt\interwordspace + \setbox##1\hpack{\raise.5\dp##1\hpack{\lower.5\ht##1\copy##1}}% + \ht##1\zeropoint + \dp##1\zeropoint + \else + \ht##1\strutht + \dp##1\strutdp + \strut + \fi + \hss\copy##1\hss} + \vss}}% + \unexpanded\def\textbox##1% + {\vpack to \scratchdimentwo + {\hsize\scratchdimenthree + ##1% + \par}}% + \unexpanded\def\scratchnum + {\blue + \tinyfont + \hfill + \number\scratchcounter + \vfill + \octnumber\scratchcounter + \hfill + \lchexnumbers\scratchcounter}% + \setbox\scratchboxone\hpack{\tf\textbox{}}% + \setbox\scratchboxtwo\hpack{\tf\gray\vrule\s!width\exheight\s!height.5\exheight\s!depth.5\exheight}% + \setbox\scratchboxtwo\wrapbox\scratchboxtwo + \setbox\scratchboxthree\hpack + {\startoverlay + {\box\scratchboxtwo} + {\box\scratchboxone} + \stopoverlay}% + \dostepwiserecurse\zerocount{15}\plusone + {\scratchcounterone\recurselevel + \hpack + {\dostepwiserecurse\zerocount{15}\plusone + {\scratchcountertwo \recurselevel + \scratchcounterthree\numexpr\scratchcounterone*16+\scratchcountertwo\relax + \scratchcounterthree\numexpr\scratchcounterfour*256+\scratchcounterthree\relax + \iffontchar\font\scratchcounterthree + \setbox\scratchbox\ruledhpack{\char\scratchcounterthree}% + \bgroup + \tf + \startoverlay + {\wrapbox\scratchbox} + {\textbox\scratchnum} + \stopoverlay + \egroup + \else + \copy\scratchboxthree + \fi}}}% + \par}} + {\tf\basegrid[\c!nx=16,\c!ny=16,\c!dx=2.5,\c!dy=2.5,\c!unit=em]} + \stopoverlay + \nointerlineskip + \vskip2\points + % the \noexpand before \blank is needed for non etex + \edef\theshowfontspecs{name: {\noexpand\black\fontname\font}\quad plane: \the\scratchcounterfour\enspace"\hexnumber\scratchcounterfour}% + \tf % also sets em + \hbox to 40\emwidth{\blue\hfill\tinyfont\setstrut\strut\theshowfontspecs} + \egroup + \ifinsidefloat\else\stopbaselinecorrection\fi + \egroup} + +% \showfontstyle[modern][rm][tf][all] % #2, #3 and #4 can be 'all' +% +% no lists any more, so no 'all' any longer +% no need to clean this up + +\permanent\protected\tolerant\gdef\showfontstyle[#1]#*[#2]#*[#3]#*[#4] + {\bgroup + \edef\m_module_fonts_show_styles {\iftok{#2}\emptytoks\s!rm,\s!ss,\s!tt,\s!mm\else#2\fi}% + \edef\m_module_fonts_show_alternatives{\iftok{#3}\emptytoks\s!tf,\s!bf,\s!it,\s!sl,\s!bs,\s!bi\else#3\fi}% + \iftok{#1}\emptytoks\else + \switchtobodyfont[#1] + \fi + \raggedright + \protected\def\dododocommand##1% + {\dostepwiserecurse\zerocount{255}\plusone + {\scratchcounter\numexpr##1*256+\recurselevel\relax + \iffontchar\font\scratchcounter\relax + \char\scratchcounter + \space + \fi}}% + \protected\def\dodocommand##1##2% + {\starttextrule{\tttf #1 ##1 ##2} + \nobreak\getvalue{##2}% + \doifelsenothing{#4} + {\dododocommand\zerocount} + {\doifelse{#4}\v!all + {\dostepwiserecurse\zerocount{255}\plusone{\normalexpanded{\dododocommand{\recurselevel}}}} + {\processcommalist[#4]{\dododocommand}}}% + \par \nobreak + \stoptextrule} + \protected\def\docommand##1% + {\getvalue{##1}% + \processcommacommand[\m_module_fonts_show_alternatives]{\dodocommand{##1}}} + \processcommacommand[\m_module_fonts_show_styles]\docommand + \egroup} + +\permanent\protected\gdef\showligature#1% + {\hbox{\type{#1}\enspace\showglyphs#1}} + +\permanent\protected\tolerant\gdef\showligatures[#1]% we keep it around for compatibility reasons + {\bgroup + \def\module_fonts_show_ligature##1{\hbox{\showglyphs##1}}% + \doifsomething{#1}{\definedfont[#1*default]}% + \starttabulate[|*{7}{c|}] + \NC\type{ff} + \NC\type{fi} + \NC\type{fl} + \NC\type{ffi} + \NC\type{ffl} + \NC\type{--} + \NC\type{---} + \NC\NR + \NC\module_fonts_show_ligature{ff} + \NC\module_fonts_show_ligature{fi} + \NC\module_fonts_show_ligature{fl} + \NC\module_fonts_show_ligature{ffi} + \NC\module_fonts_show_ligature{ffl} + \NC\module_fonts_show_ligature{--} + \NC\module_fonts_show_ligature{---} + \NC\NR + \stoptabulate + \egroup} + +\permanent\protected\gdef\showkerning + {\groupedcommandcs\showfontkerns\relax} + +\permanent\gdef\module_fonts_char_ratio#1#2% + {\ifzeropt\nextboxhtdp\else + \cldcontext{\number#1/\number\nextboxhtdp}% + \fi} + +\permanent\protected\gdef\showcharratio + {\dowithnextboxcontent + {\switchtobodyfont[10pt]}% + {\starttabulate[|l|l|l|] + \NC height \NC \the\nextboxht \NC \module_fonts_char_ratio\nextboxht \NC \NR + \NC depth \NC \the\nextboxdp \NC \module_fonts_char_ratio\nextboxdp \NC \NR + \stoptabulate} + \hbox} + +\permanent\protected\gdef\showfontparameters + {\starttabulate[|tl|l|] + \NC \type {\slantperpoint} \NC \the\fontslantperpoint \font \NC\NR + \NC \type {\interwordspace} \NC \the\fontinterwordspace \font \NC\NR + \NC \type {\interwordstretch} \NC \the\fontinterwordstretch\font \NC\NR + \NC \type {\interwordshrink} \NC \the\fontinterwordshrink \font \NC\NR + \NC \type {\exheight} \NC \the\fontexheight \font \NC\NR + \NC \type {\emwidth} \NC \the\fontemwidth \font \NC\NR + \NC \type {\extraspace} \NC \the\fontextraspace \font \NC\NR + \stoptabulate} + +\unexpanded\gdef\module_fonts_show_minimal_baseline#1% to be used in a 10 column tabulate + {\setbox\scratchbox\ruledhbox{#1}% + \normalexpanded { + \NC \ruledhbox{#1}% + \NC -> + \NC \the\htdp\scratchbox + \NC = + \NC \the\ht\scratchbox + \NC + + \NC \the\dp\scratchbox + \NC \ifcmpdim\htdp\scratchbox\baselineskip <\or=\or>\fi + \NC \the\baselineskip + \NC (\ifdim\htdp\scratchbox>\baselineskip not \fi ok) + \NC \NR}} + +\permanent\protected\gdef\showminimalbaseline + {\starttabulate[|l|T|T|T|T|T|T|T|T|T|] + \module_fonts_show_minimal_baseline{\hbox to \emwidth{\hss\showstruts\strut\hss}}% + \module_fonts_show_minimal_baseline{(/)}% + \module_fonts_show_minimal_baseline{\normalstartimath\frac{1}{2}x\normalsuperscript2\normalsubscript3\normalstopimath} + \stoptabulate} + +\permanent\protected\tolerant\gdef\showfontstrip[#1]% + {\bgroup + \def\module_fonts_show_strip_a##1##2% + {\tttf\string##1} + \def\module_fonts_show_strip_b##1##2% + {\ruledhbox{\switchtobodyfont[#1]##1{##2}}} + \def\module_fonts_show_strip_c##1##2% + {\setbox\scratchbox\hbox{\switchtobodyfont[#1]##1{##2}}% + \tt\tfx\the\ht\scratchbox}% + \def\module_fonts_show_strip_d##1##2% + {\setbox\scratchbox\hbox{\switchtobodyfont[#1]##1{##2}}% + \tt\tfx\the\wd\scratchbox}% + \def\module_fonts_show_strip_indeed##1##2##3% + {\NC##2\rm{##3}\NC + ##2\ss{##3}\NC + ##2\tt{##3}\NC + ##2\mathematics{##3}\NC + \tttf##1\NR} + \starttabulate[|c|c|c|c|c|] + \module_fonts_show_strip_indeed\relax\module_fonts_show_strip_a\empty + \TB + \module_fonts_show_strip_indeed\relax\module_fonts_show_strip_b{xxxx} + \module_fonts_show_strip_indeed\relax\module_fonts_show_strip_b{12345} + \module_fonts_show_strip_indeed\relax\module_fonts_show_strip_b{(Agw)} + \TB + \module_fonts_show_strip_indeed{(x height)}\module_fonts_show_strip_c{x} + \module_fonts_show_strip_indeed{(m width)}\module_fonts_show_strip_d{m} + \stoptabulate + \egroup} + +%D This is now moved here as there is no reason to have it in the core. Some of +%D the helpers might move to a more protected namespace. + +\newbox\otfcollector + +\permanent\protected\gdef\startotfcollecting{\ctxlua{nodes.tracers.steppers.start()}} +\permanent\protected\gdef\stopotfcollecting {\ctxlua{nodes.tracers.steppers.stop()}} +\permanent\protected\gdef\resetotfcollecting{\ctxlua{nodes.tracers.steppers.reset()}} + +% \page \showotfcomposition{arabtype*arab-default at 48pt}{-1}{الضَّرَّ} \page +% \page \showotfcomposition{arabtype*arab-default at 48pt}{-1}{لِلّٰهِ} \page + +\permanent\protected\gdef\showotfstepglyphs#1% + {\ctxlua{nodes.tracers.steppers.glyphs(\number\otfcollector,#1)}% + \unhbox\otfcollector} + +\permanent\protected\gdef\otfstepspace + {\removeunwantedspaces + \hskip.5\emwidth \s!plus .125\emwidth \s!minus .125\emwidth\relax} + +\permanent\protected\gdef\otfstepcharcommand#1#2#3% font char class + {\otfstepspace + \doif{#3}{mark}{\underbar}{U+\hexnumber{#2}}:% + \setbox\scratchbox\hbox{\ctxlua{nodes.tracers.fontchar(#1,#2)}}% + \ifzeropt\wd\scratchbox + \scratchwidth.125\onepoint + \scratchdistance\dimexpr(\emwidth/2-\scratchwidth)\relax + \kern\scratchdistance + \ruledhbox to \scratchwidth{\hss\box\scratchbox\hss}% + \kern-\scratchwidth + \hskip\scratchdistance + \else + \ruledhbox{\box\scratchbox}% + \fi + \otfstepspace} + +\permanent\protected\gdef\otfstepfontcommand#1#2#3% id font size + {\begingroup + \tttf #1: #2 @ \the\dimexpr#3\scaledpoint\relax + \endgroup} + +\permanent\protected\gdef\otfstepmessagecommand#1#2% + {\begingroup + \tttf\language\minusone + \veryraggedright + \forgetparindent + \forgeteverypar + \hangindent\emwidth + \hangafter\plusone + \dontleavehmode\detokenize{#1}\removeunwantedspaces + \doifsomething{#2}{,\space\detokenize{#2}}\endgraf + \endgroup + \blank} + +\permanent\protected\gdef\showotfstepfont + {\ctxlua{nodes.tracers.steppers.font("otfstepfontcommand")}} + +\permanent\protected\gdef\showotfstepchars#1% + {\ctxlua{nodes.tracers.steppers.codes(#1,"otfstepcharcommand","otfstepspace")}} + +\permanent\protected\gdef\showotfstepmessages#1% + {\ctxlua{nodes.tracers.steppers.messages(#1,"otfstepmessagecommand",true)}} + +\permanent\protected\gdef\showotfstepfeatures + {\ctxlua{nodes.tracers.steppers.features()}} + +\permanent\protected\gdef\otfnoffeaturesteps + {\ctxlua{nodes.tracers.steppers.nofsteps()}} + +\newconstant\showotfstepsmode \showotfstepsmode\plusfour + +\protected\gdef\showotfsteps_n + {\blank + \begingroup + \advance\leftskip6\emwidth + \showotfstepmessages\recurselevel + \par + \endgroup + \blank + \dontleavehmode + \hbox to \hsize \bgroup + \hbox to 6\emwidth \bgroup + \bf + \ifnum\recurselevel=\scratchcounter result\else step \recurselevel\fi + \hss + \egroup + \vtop \bgroup + \hsize\dimexpr\hsize-6\emwidth\relax + \resetallattributes + \lefttoright + \dontleavehmode + \ifnum\recurselevel=\scratchcounter + \ruledhbox{\box\otfcompositionbox}% + \else + \ruledhbox{\showotfstepglyphs\recurselevel}% + \fi + \quad + \showotfstepchars\recurselevel + \hfill + \par + \egroup + \egroup + \blank} + +\permanent\protected\gdef\showotfsteps + {\begingroup + \veryraggedright + \forgetparindent + \forgeteverypar + \tt + \lefttoright + \hbox to \hsize \bgroup + \hbox to 6\emwidth{\bf font\hss}% + \vtop \bgroup + \hsize\dimexpr\hsize-6\emwidth\relax + \language\minusone + \bf + \showotfstepfont + \egroup + \egroup + \blank + \hbox to \hsize \bgroup + \hbox to 6\emwidth{\bf features\hss}% + \vtop \bgroup + \hsize\dimexpr\hsize-6\emwidth\relax + \language\minusone + \showotfstepfeatures + \egroup + \egroup + \blank + \scratchcounter\otfnoffeaturesteps\relax + \dorecurse\scratchcounter + {\ifcase\showotfstepsmode + \or % 1 = only first + \ifnum\recurselevel=\plusone + \showotfsteps_n + \fi + \or % 2 = only last + \ifnum\recurselevel=\scratchcounter + \showotfsteps_n + \fi + \or % 3 = first and last + \ifnum\recurselevel=\plusone + \showotfsteps_n + \orelse\ifnum\recurselevel=\scratchcounter + \showotfsteps_n + \fi + \else % everything + \showotfsteps_n + \fi}% + \endgroup} + +\permanent\protected\gdef\startotfsample + {\enabletrackers[otf.sample.silent]% beware, kind of global + \startotfcollecting + \begingroup + \veryraggedright + \forgetparindent + \forgeteverypar} + +\permanent\protected\gdef\stopotfsample + {\endgroup + \stopotfcollecting + \disabletrackers[otf.sample]% beware, kind of global: otf.sample + \showotfsteps + \resetotfcollecting} + +\newbox\otfcompositionbox + +% this should go in spac-ali: + +\installcorenamespace{otfcompositiondir} + +\gletcsname\??otfcompositiondir -1\endcsname\righttoleft +\gletcsname\??otfcompositiondir r2l\endcsname\righttoleft +\gletcsname\??otfcompositiondir l2r\endcsname\lefttoright +\gletcsname\??otfcompositiondir +1\endcsname\lefttoright +\gletcsname\??otfcompositiondir 1\endcsname\lefttoright + +\permanent\protected\gdef\setotfcompositiondirection#1% + {\begincsname\??otfcompositiondir#1\endcsname} + +\permanent\protected\gdef\showotfcomposition#1#2#3% {font*features at size}, rl=-1, text + {\begingroup + \forgetparindent + \forgeteverypar + % \setupcolors[\c!state=\v!start]% + \setupalign[\v!verytolerant,\v!flushleft]% + \startotfsample + \nohyphens + \global\setbox\otfcompositionbox\hbox{\definedfont[#1]\relax\setotfcompositiondirection{#2}\relax#3}% + \stopotfsample + \endgroup} + +%D \startbuffer +%D \startotfcompositionlist{Serif*default @ 11pt}{l2r}% +%D \showotfcompositionsample{effe} +%D \stopotfcompositionlist +%D \stopbuffer +%D +%D \typebuffer \getbuffer + +\permanent\protected\gdef\showotfcompositionlist#1#2#3% + {\begingroup + \definedfont[#1]% + \setbox\scratchbox\hbox\bgroup + \setotfcompositiondirection{#2}% + #3% + \egroup + \strut + \def|##1|{\kern\onepoint\string|\kern\onepoint##1\kern\onepoint\string|\kern\onepoint}% + \cldcontext{nodes.listtoutf(tex.box[\number\scratchbox].list,"{\\kern\\onepoint}",true)}% + \endgroup} + +\mutable\glet\showotfcompositionsample\gobbleoneargument + +\permanent\protected\gdef\startotfcompositionlist#1#2#3\stopotfcompositionlist + {\begingroup + \protected\def\showotfcompositionsample##1% + {\NC\type{##1}% + \NC\showotfcompositionlist{Mono}{#2}{##1}% + \NC\showotfcompositionlist{#1}{#2}{##1}% + \NC\definedfont[#1]##1% + \NC\NR}% + \starttabulate[|||||]% + #3% + \stoptabulate + \endgroup} + +\aliased\glet\stopotfcompositionlist\relax + +%D Till here. + +\permanent\protected\def\showbodyfontstate + {\dontleavehmode + \start + \infofont + [fontclass: \fontclass,\space + fontbody: \fontbody ,\space + fontface: \fontface ,\space + fontsize: \fontsize ]% + \stop} + +\protect + +\continueifinputfile{s-fonts-show.mkxl} + +\setupwhitespace[big] + +\dontcomplain + +\starttext + +\startsubject[title=\type{\showkerning}] + \showkerning{Just a small sentence with hopefully some kerns.} +\stopsubject + +\startsubject[title=\type{\showcharratio}] + \showcharratio{testg} +\stopsubject + +\startsubject[title=\type{\showfontparameters}] + \showfontparameters +\stopsubject + +\startsubject[title=\type{\showminimalbaseline}] + \showminimalbaseline +\stopsubject + +\startsubject[title=\type{\showfontstrip}] + \showfontstrip +\stopsubject + +\startsubject[title=\type{\showbodyfont}] + \showbodyfont +\stopsubject + +\startsubject[title=\type{\showbodyfontenvironment}] + \showbodyfontenvironment +\stopsubject + +\startsubject[title=\type{\showligature}] + \showligature{fi} + \showligature{fx} +\stopsubject + +\startsubject[title=\type{\showligatures}] + \showligatures +\stopsubject + +\startsubject[title=\type{\showfontstyle}] + \showfontstyle[][rm][tf][all] +\stopsubject + +\startsubject[title=\type{\showfont}] + \showfont +\stopsubject + +\startsubject[title=\type{\showbodyfontstate}] + \showbodyfontstate +\stopsubject + +\page + +\startsubject[title=\type{\showotfcomposition}] + \showotfcomposition{arabtype*arabic at 48pt}{-1}{الضَّرَّ} + \page + \showotfcomposition{arabtype*arabic at 48pt}{-1}{لِلّٰهِ} + \page +\stopsubject + +\stoptext diff --git a/Master/texmf-dist/tex/context/modules/mkxl/s-layout-show.mkxl b/Master/texmf-dist/tex/context/modules/mkxl/s-layout-show.mkxl new file mode 100644 index 00000000000..95a6d3371c1 --- /dev/null +++ b/Master/texmf-dist/tex/context/modules/mkxl/s-layout-show.mkxl @@ -0,0 +1,243 @@ +%D \module +%D [ file=page-run, +%D version=2000.10.20, +%D title=\CONTEXT\ Page Macros, +%D subtitle=Runtime Macros, +%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 Page Macros / Runtime Macros} + +\registerctxluafile{page-run}{} % maybe rename this one + +\unprotect + +\permanent\protected\tolerant\gdef\showprint[#1]#*[#2]#*[#3]% only english + {\setbuffer[crap]% + \unprotect + \definepapersize[X][\c!width=4em, \c!height=6em] + \definepapersize[Y][\c!width=12em,\c!height=14em] + \setuppapersize[X,#1][Y,#2] + \setuplayout[#3] + \setuplayout[\v!page] + \framed + [\c!offset=\v!overlay,\c!strut=\v!no, + \c!width=\paperwidth,\c!height=\paperheight] + {\ss ABC\par DEF}% + \protect + \endbuffer + \framed[\c!offset=\v!overlay,\c!strut=\v!no]{\typesetbuffer[crap]}} + +% \switchtobodyfont[8pt] +% +% \startcombination[4*4] +% {\showprint} {\strut} +% {\showprint[][][location=middle]} {\type{location=middle}} +% {\showprint[][][location=middle,marking=on]} {\type{markering=aan}\break\type{location=middle}} +% {\showprint[][][location=middle,marking=on,nx=2]} {\type{markering=aan}\break\type{location=middle}\break\type{nx=2}} +% {\showprint[][][location=left]} {\type{location=left}} +% {\showprint[][][location=right]} {\type{location=right}} +% {\showprint[][][location={left,bottom}]} {\type{location={left,bottom}}} +% {\showprint[][][location={right,bottom}]} {\type{location={right,bottom}}} +% {\showprint[][][nx=2,ny=1]} {\type{nx=2,ny=1}} +% {\showprint[][][nx=1,ny=2]} {\type{nx=1,ny=2}} +% {\showprint[][][nx=2,ny=2]} {\type{nx=2,ny=2}} +% {\showprint[][][nx=2,ny=2,location=middle]} {\type{nx=2,ny=2}\break\type{location=middle}} +% {\showprint[][][backoffset=3pt]} {\type{rugoffset=.5cm}} +% {\showprint[][][topoffset=3pt]} {\type{kopoffset=.5cm}} +% {\showprint[][][scale=1.5]} {\type{schaal=1.5}} +% {\showprint[][][scale=0.8]} {\type{schaal=0.8}} +% \stopcombination +% +% \startcombination[3*4] +% {\showprint[landscape][] [location=middle]} {\type{landscape}} +% {\showprint[] [landscape][location=middle]} {\strut\break\type{landscape}} +% {\showprint[landscape][landscape][location=middle]} {\type{landscape}\break\type{landscape}} +% {\showprint[90] [] [location=middle]} {\type{90}} +% {\showprint[] [90] [location=middle]} {\strut\break\type{90}} +% {\showprint[90] [90] [location=middle]} {\type{90}\break\type{90}} +% {\showprint[180] [] [location=middle]} {\type{180}} +% {\showprint[] [180] [location=middle]} {\strut\break\type{180}} +% {\showprint[180] [180] [location=middle]} {\type{180}\break\type{180}} +% {\showprint[mirrored] [] [location=middle]} {\type{mirrored}} +% {\showprint[] [mirrored] [location=middle]} {\strut\break\type{mirrored}} +% {\showprint[mirrored] [mirrored] [location=middle]} {\type{mirrored}\break\type{mirrored}} +% \stopcombination + +\permanent\protected\tolerant\gdef\showframe[#1]#*[#2]% + {\ifarguments + \showframe + [\v!top,\v!header, + \v!text, + \v!footer,\v!bottom] + [\v!leftedge,\v!leftmargin, + \v!text, + \v!rightmargin,\v!rightedge] + \or + \showframe + [\v!header,\v!text,\v!footer] + [#1] + \or + \setupbackgrounds + [\v!page] + [\c!frame=\v!on, + \c!corner=\v!rectangular, + \c!frameoffset=\zeropoint, + \c!framedepth=\zeropoint, + \c!framecolor=layout:page] + \setupbackgrounds + [#1][#2] + [\c!background=, + \c!frame=\v!on, + \c!corner=\v!rectangular, + \c!frameoffset=\zeropoint, + \c!framedepth=\zeropoint, + \c!framecolor=] + \fi + \setupbackgrounds + [\c!state=\v!repeat]} + +\permanent\protected\tolerant\gdef\showsetups[#1]% + {\ctxcommand{showlayoutvariables("#1")}} + +\permanent\protected\tolerant\gdef\showlayout[#1]% + {\ctxcommand{showlayout("#1")}} + +\permanent\protected\gdef\showmargins + {\starttabulate + \NC asynchrone \NC \doifelseoddpage {odd} {even} \NC \NR + \NC synchrone \NC \doifelserightpage {right} {left} \NC \NR + \NC right margin \NC \the\rightmarginwidth \NC \NR + \NC left margin \NC \the\leftmarginwidth \NC \NR + \NC outer margin \NC \the\outermarginwidth \NC \NR + \NC inner margin \NC \the\innermarginwidth \NC \NR + \stoptabulate} + +%D Page grids: + +\newconstant\c_page_grids_location +\newconstant\c_page_grids_line_mode +\newconstant\c_page_grids_lineno_mode +\newconstant\c_page_grids_columns_mode + +\permanent\protected\tolerant\gdef\showgrid[#1]% + {\c_page_grids_location \plusone % downward compatible default + \c_page_grids_line_mode \plusone + \c_page_grids_lineno_mode \plusone + \c_page_grids_columns_mode\plusone + \processallactionsinset + [#1]% + [ \v!reset=>\c_page_grids_location \zerocount + \c_page_grids_columns_mode\zerocount, + \v!bottom=>\c_page_grids_location \plusone, + \v!top=>\c_page_grids_location \plustwo, + \v!none=>\c_page_grids_line_mode \zerocount, + \v!all=>\c_page_grids_line_mode \plusone, + \v!lines=>\c_page_grids_line_mode \plustwo, + \v!frame=>\c_page_grids_line_mode \plusthree, + \v!nonumber=>\c_page_grids_lineno_mode \zerocount, + \v!right=>\c_page_grids_lineno_mode \plusone, + \v!left=>\c_page_grids_lineno_mode \plustwo, + \v!outer=>\c_page_grids_lineno_mode \plusthree, + \v!inner=>\c_page_grids_lineno_mode \plusfour, + \v!columns=>\c_page_grids_columns_mode\plusone]% new option + \ifcase\c_page_grids_location + \let\page_grids_add_to_box\gobbleoneargument + \else % 1=bottom 2=top + \let\page_grids_add_to_box\page_grids_add_to_box_indeed + \fi + \ifcase\c_page_grids_columns_mode + \let\page_grids_add_to_one\gobbleoneargument + \let\page_grids_add_to_mix\gobbleoneargument + \else + \let\page_grids_add_to_one\page_grids_add_to_one_indeed + \let\page_grids_add_to_mix\page_grids_add_to_mix_indeed + \fi} + +% if really needed for speed we can cache the grid + +\glet\page_grids_add_to_box\gobbleoneargument +\glet\page_grids_add_to_one\gobbleoneargument +\glet\page_grids_add_to_mix\gobbleoneargument + +\gdef\page_grids_add_to_box_indeed#1% to be checked for color and layer ..... use mp + {\startcolor[layout:grid]% + \resetvisualizers + \gridboxlinemode \c_page_grids_line_mode + \gridboxlinenomode\c_page_grids_lineno_mode + \setgridbox\scratchbox\makeupwidth\textheight % todo: check color + \global\setbox#1\hpack % global ? + {\ifcase\c_page_grids_location\or\or\box#1\hskip-\makeupwidth\fi + \begingroup % color + \ifcase\layoutcolumns\else + \gray + \setlayoutcomponentattribute{\v!grid:\v!columns}% + \hpack \layoutcomponentboxattribute to \makeupwidth + {\dorecurse\layoutcolumns + {\hskip\layoutcolumnwidth + \ifnum\recurselevel<\layoutcolumns + \vrule + \s!height\ht\scratchbox + \s!depth \dp\scratchbox + \s!width \layoutcolumndistance + \fi}}% + \hskip-\makeupwidth + \fi + \setlayoutcomponentattribute{\v!grid:\v!lines}% + \hpack \layoutcomponentboxattribute{\box\scratchbox}% + \endgroup + \ifcase\c_page_grids_location\or\hskip-\makeupwidth\box#1\fi}% + \stopcolor} + +\gdef\page_grids_add_to_one_indeed#1% + {\begingroup + \resetvisualizers + \global\setbox#1\vpack{\noindent\backgroundline[layout:one]{\box#1}}% + \endgroup} + +\gdef\page_grids_add_to_mix_indeed#1% + {\begingroup + \resetvisualizers + \global\setbox#1\vpack{\noindent\backgroundline[layout:mix]{\box#1}}% + \endgroup} + +\protect + +\continueifinputfile{s-layout-show.mkxl} + +\setupwhitespace[big] + +\setuphead[section][page=yes] + +\starttext + +\startsubject[title=\type{\showprint}] + \showprint +\stopsubject + +\startsubject[title=\type{\showframe}] + \showframe +\stopsubject + +\startsubject[title=\type{\showlayout}] + \showlayout +\stopsubject + +\startsubject[title=\type{\showsetups}] + \showsetups +\stopsubject + +\startsubject[title=\type{\showmargins}] + \showmargins +\stopsubject + +\startsubject[title=\type{\showgrid}] + \showgrid +\stopsubject + +\stoptext diff --git a/Master/texmf-dist/tex/context/modules/mkxl/s-publications-show.mkxl b/Master/texmf-dist/tex/context/modules/mkxl/s-publications-show.mkxl new file mode 100644 index 00000000000..9f4098489ae --- /dev/null +++ b/Master/texmf-dist/tex/context/modules/mkxl/s-publications-show.mkxl @@ -0,0 +1,84 @@ +%D \module +%D [ file=publ-tra, +%D version=2013.12.24, +%D title=\CONTEXT\ Publication Support, +%D subtitle=Tracing, +%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. + +% todo: make this a runtime module +% todo: use the module interface + +\writestatus{loading}{ConTeXt Publication Support / Tracing} + +\registerctxluafile{publ-tra}{} + +\unprotect + +\permanent\protected\gdef\showbtxdatasetfields {\publ_show_dataset_whatever{showbtxdatasetfields}} +\permanent\protected\gdef\showbtxdatasetcompleteness{\publ_show_dataset_whatever{showbtxdatasetcompleteness}} +\permanent\protected\gdef\showbtxdatasetauthors {\publ_show_dataset_whatever{showbtxdatasetauthors}} + +\tolerant\gdef\publ_show_dataset_whatever#1[#2]% + {\begingroup + \letdummyparameter\c!specification\currentbtxspecification + \setdummyparameter\c!dataset {\currentbtxdataset}% + \letdummyparameter\c!field \empty + \ifparameter#2\or + \ifhastok={#2}% + \getdummyparameters[#2]% + \else + \setdummyparameter\c!dataset{#2}% + \fi + \fi + \ctxcommand{#1{ + dataset = "\dummyparameter\c!dataset", + specification = "\dummyparameter\c!specification", + field = "\dummyparameter\c!field", + }}% + \endgroup} + +\permanent\tolerant\protected\gdef\showbtxfields[#1]% + {\begingroup + \setdummyparameter\c!rotation{90}% + \ifparameter#1\or + \ifhastok={#1}% + \letdummyparameter\c!specification\currentbtxspecification + \getdummyparameters[#1]% + \else + \setdummyparameter\c!specification{#1}% + \fi + \else + \letdummyparameter\c!specification\currentbtxspecification + \fi + \ctxcommand{showbtxfields{ + rotation = "\dummyparameter\c!rotation", + specification = "\dummyparameter\c!specification" + }}% + \endgroup} + +\permanent\tolerant\protected\gdef\showbtxtables[#1]% + {\begingroup + \ctxcommand{showbtxtables{}}% + \endgroup} + +\permanent\tolerant\protected\gdef\showbtxhashedauthors[#1]% + {\ctxcommand{showbtxhashedauthors{}}} + +\protect + +\continueifinputfile{s-publications-show.mkxl} + +\starttext + + \showbtxfields[rotation=85] \page + \showbtxfields[rotation=90] \page + + \showbtxtables \page + +\stoptext diff --git a/Master/texmf-dist/tex/context/modules/mkxl/s-symbols-show.mkxl b/Master/texmf-dist/tex/context/modules/mkxl/s-symbols-show.mkxl new file mode 100644 index 00000000000..37d42fe0079 --- /dev/null +++ b/Master/texmf-dist/tex/context/modules/mkxl/s-symbols-show.mkxl @@ -0,0 +1,110 @@ +%D \module +%D [ file=symb-run, +%D version=2010.12.08, % 1998.07.20, +%D title=\CONTEXT\ Symbol Libraries, +%D subtitle=Runtime Macros, +%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. + +% todo: implementor + +\startluacode + function commands.showsymbolset(collection,symbols,fontid) + if type(symbols) == "string" then + symbols = utilities.parsers.settings_to_array(symbols) + end + local options = { framecolor = "orange", rulethickness = ".8pt", offset = interfaces.variables.overlay } + local list = table.tohash(symbols) + local alsofont = fontid > 0 + local defined = #symbols > 0 + local byname = false + if alsofont then + local is_symbol = characters.is_symbol + local chardata = characters.data + local resources = fonts.hashes.resources [fontid] + local characters = fonts.hashes.characters[fontid] + if resources and characters then + local unicodes = resources.unicodes + if unicodes then + for name, unicode in next, unicodes do + if not list[name] and name ~= ".notdef" then + local c = rawget(chardata,unicode) + if not c or is_symbol[c.category] then + list[name] = false + byname = true + end + end + end + end + end + end + local detail = defined and byname + context.start() + context.setupsymbolset { collection } + context.starttabulate { detail and "|lT|l|l|lT|" or "|lT|l|l|"} + for symbol, how in table.sortedhash(list) do + if detail and how then + context.BC() + else + context.NC() + end + context(symbol) + context.NC() + context.symbol(symbol) + context.NC() + context.framed(options,context.nested.symbol(symbol)) + if detail and how then + context.BC() + context("defined") + else + context.NC() + end + context.NC() + context.NR() + end + context.stoptabulate() + context.stop() + end +\stopluacode + +\unprotect + +\permanent\protected\tolerant\gdef\showsymbolset[#1]% + {\begingroup + \edef\p_font{\begincsname\??symboldefault#1\endcsname}% + \begingroup + \ifx\p_font\empty + \global\globalscratchcounter\zerocount + \else + \definedfont[\p_font]% + \global\globalscratchcounter\fontid\font\relax + \fi + \endgroup + \ctxcommand { + showsymbolset ( + "#1", + "\symbolset{#1}", + \the\globalscratchcounter + ) }% + \endgroup} + +\protect + +\continueifinputfile{s-symbols-show.mkxl} + +\usesymbols[cc] + +\starttext + + \showsymbolset[cc] + + \symbol[cc][cc-by-sa-nc] + +\stoptext + + -- cgit v1.2.3