summaryrefslogtreecommitdiff
path: root/tex
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2014-06-25 19:46:00 +0200
committerHans Hagen <pragma@wxs.nl>2014-06-25 19:46:00 +0200
commit1b5137f5fffe265b044838d6ee87d27070902180 (patch)
tree1282944b13996aa6aad9bd2800fbbff1bdae9f86 /tex
parenta9c288d372917c485a2882593ed18c8044bf82f1 (diff)
downloadcontext-1b5137f5fffe265b044838d6ee87d27070902180.tar.gz
beta 2014.06.25 19:46
Diffstat (limited to 'tex')
-rw-r--r--tex/context/base/back-ini.mkiv4
-rw-r--r--tex/context/base/char-ini.lua6
-rw-r--r--tex/context/base/cont-new.mkiv2
-rw-r--r--tex/context/base/context-version.pdfbin4350 -> 4353 bytes
-rw-r--r--tex/context/base/context.mkiv2
-rw-r--r--tex/context/base/lxml-aux.lua7
-rw-r--r--tex/context/base/lxml-ini.mkiv1
-rw-r--r--tex/context/base/lxml-tex.lua10
-rw-r--r--tex/context/base/meta-imp-dum.mkiv3
-rw-r--r--tex/context/base/meta-ini.mkiv30
-rw-r--r--tex/context/base/mlib-pdf.lua33
-rw-r--r--tex/context/base/mlib-pps.lua43
-rw-r--r--tex/context/base/mlib-pps.mkiv23
-rw-r--r--tex/context/base/status-files.pdfbin24859 -> 24843 bytes
-rw-r--r--tex/context/base/status-lua.pdfbin248321 -> 248280 bytes
-rw-r--r--tex/context/base/strc-reg.lua120
-rw-r--r--tex/context/base/strc-reg.mkiv69
-rw-r--r--tex/context/base/tabl-ntb.mkiv31
-rw-r--r--tex/context/base/typo-dha.lua4
-rw-r--r--tex/context/base/typo-dir.mkiv3
-rw-r--r--tex/context/base/typo-dub.lua2
-rw-r--r--tex/context/base/typo-mar.lua7
-rw-r--r--tex/context/base/typo-pag.lua23
-rw-r--r--tex/context/base/x-asciimath.lua40
-rw-r--r--tex/context/base/x-asciimath.mkiv54
-rw-r--r--tex/context/fonts/treatments.lfg46
-rw-r--r--tex/generic/context/luatex/luatex-fonts-merged.lua2
27 files changed, 300 insertions, 265 deletions
diff --git a/tex/context/base/back-ini.mkiv b/tex/context/base/back-ini.mkiv
index 8a3f77b1d..057cb840f 100644
--- a/tex/context/base/back-ini.mkiv
+++ b/tex/context/base/back-ini.mkiv
@@ -158,4 +158,8 @@
\ctxcommand{setrealspaces("\backendparameter\c!space")}%
\to \everysetupbackend
+%D For older styles:
+
+\let\setupoutput\gobbleoneoptional
+
\protect \endinput
diff --git a/tex/context/base/char-ini.lua b/tex/context/base/char-ini.lua
index 33b1550af..eb73cc19e 100644
--- a/tex/context/base/char-ini.lua
+++ b/tex/context/base/char-ini.lua
@@ -37,6 +37,12 @@ from the big character table that we use for all kind of purposes:
loaded!</p>
--ldx]]--
+-- todo: in 'char-def.lua' assume defaults:
+--
+-- directtions = l
+-- cjkwd = a
+-- linebreak = al
+
characters = characters or { }
local characters = characters
local data = characters.data
diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv
index bd6e4ba28..39a532338 100644
--- a/tex/context/base/cont-new.mkiv
+++ b/tex/context/base/cont-new.mkiv
@@ -11,7 +11,7 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-\newcontextversion{2014.06.22 19:58}
+\newcontextversion{2014.06.25 19:46}
%D This file is loaded at runtime, thereby providing an excellent place for
%D hacks, patches, extensions and new features.
diff --git a/tex/context/base/context-version.pdf b/tex/context/base/context-version.pdf
index 7efbbe53d..4af7b644d 100644
--- a/tex/context/base/context-version.pdf
+++ b/tex/context/base/context-version.pdf
Binary files differ
diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv
index 8c2f9fcaf..72c8e2dc6 100644
--- a/tex/context/base/context.mkiv
+++ b/tex/context/base/context.mkiv
@@ -28,7 +28,7 @@
%D up and the dependencies are more consistent.
\edef\contextformat {\jobname}
-\edef\contextversion{2014.06.22 19:58}
+\edef\contextversion{2014.06.25 19:46}
\edef\contextkind {beta}
%D For those who want to use this:
diff --git a/tex/context/base/lxml-aux.lua b/tex/context/base/lxml-aux.lua
index 963873bc9..70364b657 100644
--- a/tex/context/base/lxml-aux.lua
+++ b/tex/context/base/lxml-aux.lua
@@ -405,7 +405,14 @@ local function include(xmldata,pattern,attribute,recursive,loaddata)
end
local child = xml.body(xi) -- xml.assign(d,k,xi)
child.__p__ = ekrt
+ child.__f__ = name -- handy for tracing
epdt[ek.ni] = child
+ local inclusions = xmldata.settings.inclusions
+ if inclusions then
+ inclusions[#inclusions+1] = name
+ else
+ xmldata.settings.inclusions = { name }
+ end
end
end
end
diff --git a/tex/context/base/lxml-ini.mkiv b/tex/context/base/lxml-ini.mkiv
index 752e315da..3935b9516 100644
--- a/tex/context/base/lxml-ini.mkiv
+++ b/tex/context/base/lxml-ini.mkiv
@@ -59,6 +59,7 @@
\def\xmlidx #1#2#3{\ctxlxml{idx("#1","#2",\number#3)}}
\def\xmlinclude #1#2#3{\ctxlxml{include("#1","#2","#3",true)}}
\def\xmlincludeoptions#1#2#3#4{\ctxlxml{include("#1","#2","#3","#4")}}
+\def\xmlincludedfrom #1{\ctxlxml{includedfrom("#1")}}
\def\xmlsave #1#2{\ctxlxml{save("#1","#2")}}
\def\xmlindex #1#2#3{\ctxlxml{index("#1","#2",\number#3)}}
\def\xmlinfo #1{\hbox{\ttxx[\ctxlxml{info("#1")}]}}
diff --git a/tex/context/base/lxml-tex.lua b/tex/context/base/lxml-tex.lua
index 0c58a47cc..c1aea3853 100644
--- a/tex/context/base/lxml-tex.lua
+++ b/tex/context/base/lxml-tex.lua
@@ -518,6 +518,16 @@ function lxml.include(id,pattern,attribute,options)
stoptiming(xml)
end
+function lxml.includedfrom(id)
+ local x = getid(id)
+ local f = x and x.__f__
+ if f then
+ context(f)
+ else
+ -- maybe some message
+ end
+end
+
function lxml.save(id,name)
xml.save(getid(id),name)
end
diff --git a/tex/context/base/meta-imp-dum.mkiv b/tex/context/base/meta-imp-dum.mkiv
index 1daff57ac..e6ccc234c 100644
--- a/tex/context/base/meta-imp-dum.mkiv
+++ b/tex/context/base/meta-imp-dum.mkiv
@@ -60,6 +60,8 @@
% \stopuseMPgraphic
\startuseMPgraphic{figure:placeholder}{width,height,reduction,color}
+ begingroup ;
+ save w, h, d, r, p, c, b ;
numeric w, h, d, r ; path p ;
if cmykcolor \MPvar{color} :
cmykcolor c, b ; b := (0,0,0,0)
@@ -80,6 +82,7 @@
withcolor r[c randomized(.3,.9),b] ;
endfor ;
clip currentpicture to p ;
+ endgroup ;
\stopuseMPgraphic
\defineoverlay
diff --git a/tex/context/base/meta-ini.mkiv b/tex/context/base/meta-ini.mkiv
index ff7012caf..aa8ae24f8 100644
--- a/tex/context/base/meta-ini.mkiv
+++ b/tex/context/base/meta-ini.mkiv
@@ -338,14 +338,32 @@
%D Calling up previously defined graphics.
+% \def\includeMPgraphic#1% gets expanded !
+% {\ifcsname\??mpgraphic#1\endcsname
+% \csname\??mpgraphic#1\endcsname ; % ; is safeguard
+% \fi}
+%
+% \unexpanded\def\meta_enable_include % public
+% {\let\meta_handle_use_graphic \thirdofthreearguments
+% \let\meta_handle_reusable_graphic\thirdofthreearguments}
+%
+% but ... we want this too:
+%
+% \startuseMPgraphic{x}
+% draw textext("\externalfigure[foo.pdf]") ;
+% \stopuseMPgraphic
+%
+% \useMPgraphic{x}
+%
+% so we cannot overload unless we let back to the original meanings
+% each graphic ... a better solution is:
+
\def\includeMPgraphic#1% gets expanded !
{\ifcsname\??mpgraphic#1\endcsname
- \csname\??mpgraphic#1\endcsname ; % ; is safeguard
+ \doubleexpandafter\fourthoffourarguments\csname\??mpgraphic#1\endcsname ; % ; is safeguard
\fi}
-\unexpanded\def\meta_enable_include % public
- {\let\meta_handle_use_graphic \thirdofthreearguments
- \let\meta_handle_reusable_graphic\thirdofthreearguments}
+\let\meta_enable_include\relax
%D Drawings (stepwise built):
@@ -787,10 +805,6 @@
\let\reuseMPgraphic \useMPgraphic % we can save a setup here if needed
\let\reusableMPgraphic\reuseMPgraphic % we can save a setup here if needed
-\unexpanded\def\meta_enable_include
- {\let\meta_handle_use_graphic \thirdofthreearguments
- \let\meta_handle_reusable_graphic\thirdofthreearguments}
-
%D \macros
%D {startuniqueMPpagegraphic,uniqueMPpagegraphic}
%D
diff --git a/tex/context/base/mlib-pdf.lua b/tex/context/base/mlib-pdf.lua
index 82db18fec..80c554de1 100644
--- a/tex/context/base/mlib-pdf.lua
+++ b/tex/context/base/mlib-pdf.lua
@@ -33,7 +33,6 @@ metapost.flushers = metapost.flushers or { }
local pdfflusher = { }
metapost.flushers.pdf = pdfflusher
-metapost.multipass = false -- to be stacked
metapost.n = 0
metapost.optimize = true -- false
@@ -64,23 +63,6 @@ end
-- get a new result table and the stored objects are forgotten. Otherwise they
-- are reused.
--- local function getobjects(result,figure,index)
--- if metapost.optimize then
--- local objects = result.objects
--- if not objects then
--- result.objects = { }
--- end
--- objects = result.objects[index]
--- if not objects then
--- objects = figure:objects()
--- result.objects[index] = objects
--- end
--- return objects
--- else
--- return figure:objects()
--- end
--- end
-
local function getobjects(result,figure,index)
if metapost.optimize then
local robjects = result.objects
@@ -101,15 +83,14 @@ end
function metapost.convert(result, trialrun, flusher, multipass, askedfig)
if trialrun then
- metapost.multipass = false
- metapost.parse(result, askedfig)
- if multipass and not metapost.multipass and metapost.optimize then
- metapost.flush(result, flusher, askedfig) -- saves a run
+ local multipassindeed = metapost.parse(result,askedfig)
+ if multipass and not multipassindeed and metapost.optimize then
+ metapost.flush(result,flusher,askedfig) -- saves a run
else
return false
end
else
- metapost.flush(result, flusher, askedfig)
+ metapost.flush(result,flusher,askedfig)
end
return true -- done
end
@@ -598,6 +579,7 @@ function metapost.parse(result,askedfig)
if result then
local figures = result.fig
if figures then
+ local multipass = false
local analyzeplugins = metapost.analyzeplugins -- each object
for index=1,#figures do
local figure = figures[index]
@@ -606,7 +588,9 @@ function metapost.parse(result,askedfig)
local objects = getobjects(result,figure,index)
if objects then
for o=1,#objects do
- analyzeplugins(objects[o])
+ if analyzeplugins(objects[o]) then
+ multipass = true
+ end
end
end
if askedfig ~= "all" then
@@ -614,6 +598,7 @@ function metapost.parse(result,askedfig)
end
end
end
+ return multipass
end
end
end
diff --git a/tex/context/base/mlib-pps.lua b/tex/context/base/mlib-pps.lua
index 9a3ab8f4c..693c6acb6 100644
--- a/tex/context/base/mlib-pps.lua
+++ b/tex/context/base/mlib-pps.lua
@@ -6,8 +6,6 @@ if not modules then modules = { } end modules ['mlib-pps'] = {
license = "see context related readme files",
}
--- todo: pass multipass nicer
-
local format, gmatch, match, split = string.format, string.gmatch, string.match, string.split
local tonumber, type = tonumber, type
local round = math.round
@@ -23,6 +21,7 @@ local context_setvalue = context.setvalue
local texgetbox = tex.getbox
local texsetbox = tex.setbox
+local textakebox = tex.takebox
local copy_list = node.copy_list
local free_list = node.flush_list
local setmetatableindex = table.setmetatableindex
@@ -239,12 +238,12 @@ local function preset(t,k)
return v
end
-local function startjob(texmode)
+local function startjob(plugmode)
top = {
textexts = { }, -- all boxes, optionally with a different color
texlast = 0,
texdata = setmetatableindex({},preset), -- references to textexts in order or usage
- texmode = texmode, -- some day we can then skip all pre/postscripts
+ plugmode = plugmode, -- some day we can then skip all pre/postscripts
}
insert(stack,top)
if trace_runs then
@@ -270,17 +269,13 @@ local function stopjob()
end
end
-function metapost.settextexts () end -- obsolete
-function metapost.resettextexts() end -- obsolete
-
-- end of new
function metapost.settext(box,slot)
top.textexts[slot] = copy_list(texgetbox(box))
texsetbox(box,nil)
- -- this will become
- -- top.textexts[slot] = texgetbox(box)
- -- unsetbox(box)
+ -- this can become
+ -- top.textexts[slot] = textakebox(box)
end
function metapost.gettext(box,slot)
@@ -582,7 +577,6 @@ local function extrapass()
top.data,
top.wrappit and do_end_fig or "",
}, false, nil, false, true, top.askedfig)
- -- context.MPLIBresettexts() -- must happen afterwards
end
function metapost.graphic_base_pass(specification) -- name will change (see mlib-ctx.lua)
@@ -741,13 +735,13 @@ end
-- -- the new plugin handler -- --
-local sequencers = utilities.sequencers
-local appendgroup = sequencers.appendgroup
-local appendaction = sequencers.appendaction
+local sequencers = utilities.sequencers
+local appendgroup = sequencers.appendgroup
+local appendaction = sequencers.appendaction
-local resetter = nil
-local analyzer = nil
-local processor = nil
+local resetter = nil
+local analyzer = nil
+local processor = nil
local resetteractions = sequencers.new { arguments = "t" }
local analyzeractions = sequencers.new { arguments = "object,prescript" }
@@ -794,7 +788,7 @@ end
-- end
function metapost.pluginactions(what,t,flushfigure) -- before/after object, depending on what
- if top.texmode then
+ if top.plugmode then -- hm, what about other features
for i=1,#what do
local wi = what[i]
if type(wi) == "function" then
@@ -811,7 +805,7 @@ function metapost.pluginactions(what,t,flushfigure) -- before/after object, depe
end
function metapost.resetplugins(t) -- intialize plugins, before figure
- if top.texmode then
+ if top.plugmode then
-- plugins can have been added
resetter = resetteractions.runner
analyzer = analyzeractions.runner
@@ -822,16 +816,18 @@ function metapost.resetplugins(t) -- intialize plugins, before figure
end
function metapost.analyzeplugins(object) -- each object (first pass)
- if top.texmode then
+ if top.plugmode then
local prescript = object.prescript -- specifications
if prescript and #prescript > 0 then
- return analyzer(object,splitprescript(prescript))
+ analyzer(object,splitprescript(prescript))
+ return top.multipass
end
end
+ return false
end
function metapost.processplugins(object) -- each object (second pass)
- if top.texmode then
+ if top.plugmode then
local prescript = object.prescript -- specifications
if prescript and #prescript > 0 then
local before = { }
@@ -934,7 +930,6 @@ local function tx_analyze(object,prescript) -- todo: hash content and reuse them
ctx_MPLIBsetNtext(tx_last,s)
end
top.multipass = true
- metapost.multipass = true -- ugly
data.texhash [h] = tx_last
data.texslots[tx_trial] = tx_last
data.texorder[tx_number] = tx_last
@@ -957,7 +952,6 @@ local function tx_analyze(object,prescript) -- todo: hash content and reuse them
top.texlast = tx_last
context.MPLIBsettext(tx_last,s)
top.multipass = true
- metapost.multipass = true -- ugly
data.texslots[tx_trial] = tx_last
data.texorder[tx_number] = tx_last
if trace_textexts then
@@ -1025,7 +1019,6 @@ local function gt_analyze(object,prescript)
graphics[gt_index] = formatters["\\MPLIBgraphictext{%s}"](object.postscript or "")
top.intermediate = true
top.multipass = true
- metapost.multipass = true -- ugly
end
end
diff --git a/tex/context/base/mlib-pps.mkiv b/tex/context/base/mlib-pps.mkiv
index 207d9730c..e38799dba 100644
--- a/tex/context/base/mlib-pps.mkiv
+++ b/tex/context/base/mlib-pps.mkiv
@@ -33,26 +33,6 @@
\newbox \MPtextbox
\newtoks\everyMPLIBsettext % not used
-% \def\MPLIBsettext#1% #2%
-% {\dowithnextbox{\ctxlua{metapost.settext(\number\nextbox,#1)}}\hbox}
-%
-% \def\MPLIBresettexts
-% {\ctxlua{metapost.resettextexts()}}
-%
-% \newconditional\MPLIBtextgetdone
-%
-% \def\MPLIBsettext#1% #2%
-% {\ifconditional\MPLIBtextgetdone
-% \else
-% \cldcontext{metapost.tex.get()}% MPenvironments are depricated
-% \settrue\MPLIBtextgetdone % no \global needed
-% \fi
-% \dowithnextbox{\ctxlua{metapost.settext(\number\nextbox,#1)}}\hbox}
-%
-% \def\MPLIBresettexts
-% {\ctxlua{metapost.resettextexts()}%
-% \setfalse\MPLIBtextgetdone}
-
\def\doMPLIBflushenvironment
{%\writestatus\m!metapost{flushing environment}%
\cldcontext{metapost.tex.get()}%
@@ -77,9 +57,6 @@
\let\MPLIBsettext\MPLIBsetNtext
-\unexpanded\def\MPLIBresettexts
- {\ctxlua{metapost.resettextexts()}}
-
\unexpanded\def\MPLIBgettextscaled#1#2#3% why a copy .. can be used more often
{\ctxlua{metapost.gettext(\number\MPtextbox,#1)}%
\vbox to \zeropoint{\vss\hbox to \zeropoint{\scale[\c!sx=#2,\c!sy=#3]{\raise\dp\MPtextbox\box\MPtextbox}\forcecolorhack\hss}}}
diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf
index 25568dc25..55e076014 100644
--- a/tex/context/base/status-files.pdf
+++ b/tex/context/base/status-files.pdf
Binary files differ
diff --git a/tex/context/base/status-lua.pdf b/tex/context/base/status-lua.pdf
index 977d36057..92d86086a 100644
--- a/tex/context/base/status-lua.pdf
+++ b/tex/context/base/status-lua.pdf
Binary files differ
diff --git a/tex/context/base/strc-reg.lua b/tex/context/base/strc-reg.lua
index bdb2e0d67..e9186e390 100644
--- a/tex/context/base/strc-reg.lua
+++ b/tex/context/base/strc-reg.lua
@@ -508,7 +508,7 @@ end
local seeindex = 0
--- meerdere loops, seewords, dan words, an seewords
+-- meerdere loops, seewords, dan words, anders seewords
local function crosslinkseewords(result) -- all words
-- collect all seewords
@@ -866,76 +866,88 @@ function registers.flush(data,options,prefixspec,pagespec)
local data = sublist.data
local d, n = 0, 0
ctx_startregistersection(sublist.tag)
- for d=1,#data do
- local entry = data[d]
- if entry.metadata.kind == "see" then
- local list = entry.list
- if #list > 1 then
- list[#list] = nil
- else
- -- we have an \seeindex{Foo}{Bar} without Foo being defined anywhere
- report_registers("invalid see entry in register %a, reference %a",entry.metadata.name,list[1][1])
- end
- end
- end
+
+-- -- no: we lost the see word
+--
+-- for d=1,#data do
+-- local entry = data[d]
+-- if entry.metadata.kind == "see" then
+-- local list = entry.list
+-- if #list > 1 then
+-- list[#list] = nil
+-- else
+-- -- we have an \seeindex{Foo}{Bar} without Foo being defined anywhere
+-- report_registers("invalid see entry in register %a, reference %a",entry.metadata.name,list[1][1])
+-- end
+-- end
+-- end
+
-- ok, this is tricky: we use e[i] delayed so we need it to be local
-- but we don't want to allocate too many entries so there we go
while d < #data do
d = d + 1
- local entry = data[d]
+ local entry = data[d]
+ local metadata = entry.metadata
+ local kind = metadata.kind
+ local list = entry.list
local e = { false, false, false }
for i=3,maxlevel do
e[i] = false
end
- local metadata = entry.metadata
- local kind = metadata.kind
- local list = entry.list
for i=1,maxlevel do
if list[i] then
e[i] = list[i][1]
end
- if e[i] ~= done[i] then
- if e[i] and e[i] ~= "" then
- done[i] = e[i]
- for j=i+1,maxlevel do
- done[j] = false
- end
- if started then
- ctx_stopregisterentry()
- started = false
- end
- if n == i then
+ if e[i] == done[i] then
+ -- skip
+ elseif not e[i] then
+ -- see ends up here
+ -- can't happen any more
+ done[i] = false
+ for j=i+1,maxlevel do
+ done[j] = false
+ end
+ elseif e[i] == "" then
+ done[i] = false
+ for j=i+1,maxlevel do
+ done[j] = false
+ end
+ else
+ done[i] = e[i]
+ for j=i+1,maxlevel do
+ done[j] = false
+ end
+ if started then
+ ctx_stopregisterentry()
+ started = false
+ end
+ if n == i then
-- ctx_stopregisterentries()
-- ctx_startregisterentries(n)
- else
- while n > i do
- n = n - 1
- ctx_stopregisterentries()
- end
- while n < i do
- n = n + 1
- ctx_startregisterentries(n)
- end
+ else
+ while n > i do
+ n = n - 1
+ ctx_stopregisterentries()
end
- local references = entry.references
- local processors = entry.processors
- local internal = references.internal or 0
- local seeparent = references.seeparent or ""
- local processor = processors and processors[1] or ""
- -- so, we need to keep e as is (local), or we need local title = e[i] ... which might be
- -- more of a problem
- ctx_startregisterentry(0) -- will become a counter
- started = true
- if metadata then
- ctx_registerentry(processor,internal,seeparent,function() h_title(e[i],metadata) end)
- else -- ?
- ctx_registerentry(processor,internal,seeindex,e[i])
+ while n < i do
+ n = n + 1
+ ctx_startregisterentries(n)
end
+ end
+ local references = entry.references
+ local processors = entry.processors
+ local internal = references.internal or 0
+ local seeparent = references.seeparent or ""
+ local processor = processors and processors[1] or ""
+ -- so, we need to keep e as is (local), or we need local title = e[i] ... which might be
+ -- more of a problem
+ ctx_startregisterentry(0) -- will become a counter
+ started = true
+ if metadata then
+ ctx_registerentry(processor,internal,seeparent,function() h_title(e[i],metadata) end)
else
- done[i] = false
- for j=i+1,maxlevel do
- done[j] = false
- end
+ -- can this happen?
+ ctx_registerentry(processor,internal,seeindex,e[i])
end
end
end
diff --git a/tex/context/base/strc-reg.mkiv b/tex/context/base/strc-reg.mkiv
index d072aca69..a09289b49 100644
--- a/tex/context/base/strc-reg.mkiv
+++ b/tex/context/base/strc-reg.mkiv
@@ -520,27 +520,6 @@
\unexpanded\def\placeregister
{\dodoubleempty\strc_registers_place}
-% \def\strc_registers_place[#1][#2]%
-% {\iffirstargument
-% \begingroup
-% %\forgetall
-% \edef\currentregister{#1}%
-% \setupregister[\currentregister][#2]%
-% \the\everyplaceregister
-% \ifnum\registerparameter\c!n>\plusone
-% \startcolumns
-% [\c!n=\registerparameter\c!n,
-% \c!balance=\registerparameter\c!balance,
-% \c!align=\registerparameter\c!align,
-% \c!tolerance=\registerparameter\c!tolerance]%
-% \strc_registers_place_indeed
-% \stopcolumns
-% \else
-% \strc_registers_place_indeed
-% \fi
-% \endgroup
-% \fi}
-
\def\strc_registers_place[#1][#2]%
{\iffirstargument
\begingroup
@@ -558,18 +537,6 @@
\endgroup
\fi}
-% \def\strc_registers_place_columns
-% {\startmixedcolumns[\currentregister]
-% \startpacked[\v!blank]%
-% \strc_registers_place_indeed
-% \stoppacked
-% \stopmixedcolumns}
-%
-% \def\strc_registers_place_normal
-% {\startpacked[\v!blank]%
-% \strc_registers_place_indeed
-% \stoppacked}
-
\def\strc_registers_place_indeed
{\ctxcommand{processregister('\currentregister',{
language = "\registerparameter\s!language",
@@ -711,7 +678,7 @@
%D placeindex as then flushing takes place inside the index. Took me hours
%D to notice that.
-\newconditional\c_strc_registers_page_done
+\newconstant \c_strc_registers_page_state % 0=nothing 1=page 2=see
\newdimen \d_strc_registers_distance
\unexpanded\def\startregisteroutput
@@ -728,18 +695,6 @@
\dostoptagged
\endgroup}
-% \unexpanded\def\startregisterentries#1% depth
-% {\endgraf
-% \begingroup
-% \dostarttagged\t!registerentries\empty
-% \let\savedcurrentregister\currentregister
-% \edef\currentregister{\currentregister:#1}%
-% \useregisterstyleandcolor\c!textstyle\c!textcolor
-% \advance\leftskip\numexpr#1-\plusone\relax\dimexpr\d_strc_registers_distance\relax
-% \hangindent\registerparameter\c!distance\relax
-% \hangafter\plusone
-% \let\currentregister\savedcurrentregister}
-
\newdimen\d_strc_registers_hangindent
\newcount\c_strc_registers_hangafter
@@ -756,7 +711,7 @@
\fi
\d_strc_registers_hangindent\registerparameter\c!distance\relax
\c_strc_registers_hangafter \plusone
-\blank[\v!samepage]%
+ \blank[\v!samepage]%
\let\currentregister\savedcurrentregister}
\unexpanded\def\stopregisterentries
@@ -766,11 +721,13 @@
\unexpanded\def\startregisterentry#1% todo: level
{\begingroup
+ \global\setconstant\c_strc_registers_page_state\zerocount
\hangindent\d_strc_registers_hangindent
\hangafter \c_strc_registers_hangafter}
\unexpanded\def\stopregisterentry
{\endgraf
+ \global\setconstant\c_strc_registers_page_state\zerocount
\endgroup}
\unexpanded\def\startregistersection#1% title
@@ -786,7 +743,6 @@
\unexpanded\def\startregisterpages
{\begingroup
\dostarttagged\t!registerpages\empty
- \setfalse\c_strc_registers_page_done
\useregisterstyleandcolor\c!pagestyle\c!pagecolor}
\unexpanded\def\stopregisterpages
@@ -794,9 +750,8 @@
\endgroup}
\unexpanded\def\startregisterseewords
- {\ifhmode\crlf\fi
+ {%\par % \ifhmode\crlf\fi % otherwise wrong level
\begingroup
- \setfalse\c_strc_registers_page_done
\dostarttagged\t!registerpage\empty
\useregisterstyleandcolor\c!pagestyle\c!pagecolor}
@@ -805,11 +760,12 @@
\endgroup}
\unexpanded\def\registerpageseparator% todo: , configurable
- {\ifconditional\c_strc_registers_page_done
- \registerpageseparatorsymbol
- \else
+ {\ifcase\c_strc_registers_page_state
\hskip\d_strc_registers_distance\relax
- \settrue\c_strc_registers_page_done
+ \or
+ \registerpageseparatorsymbol % page
+ \or
+ \registerpageseparatorsymbol % see
\fi}
\unexpanded\def\registeronepagerangeseparator
@@ -825,12 +781,14 @@
\unexpanded\def\registeronepage#1#2#3#4% #1:processor content
{\registerpageseparator
+ \global\setconstant\c_strc_registers_page_state\plusone
\dostarttagged\t!registerpage\empty
\withregisterpagecommand{#1}{#2}{#3}{#4}%
\dostoptagged}
\unexpanded\def\registerpagerange#1#2#3#4#5#6#7% #1:processor content, content todo: -- configurable
{\registerpageseparator
+ \global\setconstant\c_strc_registers_page_state\plusone
\dostarttagged\t!registerpagerange\empty
\dostarttagged\t!registerfrompage\empty
\withregisterpagecommand{#1}{#2}{#3}{#4}%
@@ -876,7 +834,8 @@
\fi}
\unexpanded\def\defaultregisterseeword#1#2#3#4#5#6% i n #3:processor #4:internal #5:seeindex #6:word
- {%\registerpageseparator
+ {\registerpageseparator
+ \global\setconstant\c_strc_registers_page_state\plustwo
\def\currentregisterpageindex{#4}%
\dostarttagged\t!registersee\empty
\settrue\c_strc_registers_page_done
diff --git a/tex/context/base/tabl-ntb.mkiv b/tex/context/base/tabl-ntb.mkiv
index 3166e9307..9adacad3c 100644
--- a/tex/context/base/tabl-ntb.mkiv
+++ b/tex/context/base/tabl-ntb.mkiv
@@ -21,6 +21,8 @@
\writestatus{loading}{ConTeXt Table Macros / Natural Tables}
+% sometimes this helps (with nc going wild): \setupTABLE[maxwidth=100cm]
+%
% bug: width 3cm is not honored and column becomes too wide
% as given width is added to distributed width
%
@@ -145,6 +147,9 @@
\newcount\c_tabl_ntb_maximum_row_span
\newcount\c_tabl_ntb_maximum_col_span
+\newcount\c_tabl_ntb_encountered_col
+\newcount\c_tabl_ntb_encountered_max
+
\newtoks\t_tabl_ntb
\newtoks\t_tabl_ntb_row
@@ -585,6 +590,7 @@
\unexpanded\def\tabl_ntb_tr
{\c_tabl_ntb_running_col\zerocount
+ \c_tabl_ntb_encountered_col\zerocount
\advance\c_tabl_ntb_maximum_row\plusone
\iffirstargument
\expandafter\tabl_ntb_tr_yes
@@ -599,7 +605,8 @@
\def\m_tabl_ntb_default_nc{\naturaltableparameter\c!nc}
\unexpanded\def\tabl_ntb_td
- {\iffirstargument
+ {\advance\c_tabl_ntb_encountered_col\plusone
+ \iffirstargument
\expandafter\tabl_ntb_td_yes
\else
\expandafter\tabl_ntb_td_nop
@@ -659,7 +666,10 @@
% save text
\normalexpanded
{\tabl_ntb_set_txt_process\c_tabl_ntb_maximum_row\c_tabl_ntb_running_col{\the\c_tabl_ntb_maximum_row}{\the\c_tabl_ntb_running_col}}%
- {#1}{#2}}
+ {#1}{#2}%
+ \ifnum\c_tabl_ntb_encountered_col>\c_tabl_ntb_encountered_max
+ \c_tabl_ntb_encountered_max\c_tabl_ntb_encountered_col
+ \fi}
\def\tabl_ntb_td_nop[#1]#2\eTD
{\global\advance\c_tabl_ntb_spn\plusone\relax
@@ -679,7 +689,10 @@
\tabl_ntb_let_ref\c_tabl_ntb_maximum_row\c_tabl_ntb_running_col\empty
\normalexpanded
{\tabl_ntb_set_txt_process\c_tabl_ntb_maximum_row\c_tabl_ntb_running_col{\the\c_tabl_ntb_maximum_row}{\the\c_tabl_ntb_running_col}}%
- {#1}{#2}}
+ {#1}{#2}%
+ \ifnum\c_tabl_ntb_encountered_col>\c_tabl_ntb_encountered_max
+ \c_tabl_ntb_encountered_max\c_tabl_ntb_encountered_col
+ \fi}
\def\tabl_ntb_td_pass_n#1%
{\scratchcounter\numexpr\m_tabl_ntb_n-\c_tabl_ntb_running_col+\minusone-\c_tabl_ntb_spn\relax
@@ -1333,12 +1346,15 @@
\fi
\else\ifautoTBLrowspan\ifnum\c_tabl_ntb_maximum_row_span>\plusone % max ?
% added jan 2002 because nx=* did no longer work
+ \ifnum\c_tabl_ntb_encountered_max<\c_tabl_ntb_maximum_col
+ % added jun 2014 because someone had less columns than nx .. sigh / see *nx*
+ \writestatus\m!TABLE{missing\space\number\numexpr\c_tabl_ntb_maximum_col-\c_tabl_ntb_encountered_max\relax\space column(s), guessing widths}%
+ \fi
\edef\savedhsize{\the\hsize}%
\hsize\wd0\relax % new per 17/04/2006
\tabl_ntb_check_widths_one % trial run
\tabl_ntb_check_widths_two % real run
\hsize\savedhsize
- %
\let\tabl_ntb_cell_process\tabl_ntb_cell_process_c
\setbox\scratchbox\vbox{\settrialtypesetting \tabl_ntb_flush_content}%
\fi\fi\fi\fi
@@ -1456,7 +1472,9 @@
\else
% eigenlijk moet dit alleen als de kolom wordt overspannen door een
% vorige, maw extra dubbele loop en status var
- \advance\!!counta \plusone
+ \ifnum\c_tabl_ntb_encountered_max=\c_tabl_ntb_maximum_col % *nx* bah
+ \advance\!!counta \plusone % settign maxwidth to a large value also works
+ \fi
\fi
\fi
\fi}%
@@ -1641,8 +1659,7 @@
% unless span
\tabl_ntb_set_aut\c_tabl_ntb_col{\the\wd\scratchbox}%
% to be translated
- \writestatus\m!TABLE
- {no auto width in (\number#1,\number#2)\space\the\wd\scratchbox/\the\hsize}%
+ \writestatus\m!TABLE{no auto width in (\number#1,\number#2)\space\the\wd\scratchbox/\the\hsize}%
\fi\fi
\fi
\fi
diff --git a/tex/context/base/typo-dha.lua b/tex/context/base/typo-dha.lua
index 8cc6ac5dc..904b774ec 100644
--- a/tex/context/base/typo-dha.lua
+++ b/tex/context/base/typo-dha.lua
@@ -184,9 +184,9 @@ local function process(start)
finidir = finish
end
if embedded <= 0 then
- finish, autodir, done = "TRT", -1
+ finish, autodir = "TRT", -1
else
- finish, autodir, done = "TLT", 1
+ finish, autodir = "TLT", 1
end
done = true
if finidir == finish then
diff --git a/tex/context/base/typo-dir.mkiv b/tex/context/base/typo-dir.mkiv
index 0362af56c..69adb14a9 100644
--- a/tex/context/base/typo-dir.mkiv
+++ b/tex/context/base/typo-dir.mkiv
@@ -13,6 +13,9 @@
\writestatus{loading}{ConTeXt Typesetting Macros / Directions}
+%D At some point we might default to method 'two' but first I need to make it more
+%D efficient (and provide some options). I also want to have some basic tracing.
+
\unprotect
\registerctxluafile{typo-dir}{1.001}
diff --git a/tex/context/base/typo-dub.lua b/tex/context/base/typo-dub.lua
index 5408b3cae..1abe5cef5 100644
--- a/tex/context/base/typo-dub.lua
+++ b/tex/context/base/typo-dub.lua
@@ -146,7 +146,7 @@ local report_directions = logs.reporter("typesetting","directions two")
--
-- l : left to right
-- r : right to left
--- al : right to legt arabic (esp punctuation issues)
+-- al : right to left arabic (esp punctuation issues)
-- explicit: (new)
--
diff --git a/tex/context/base/typo-mar.lua b/tex/context/base/typo-mar.lua
index 5eb129ed5..5096e0042 100644
--- a/tex/context/base/typo-mar.lua
+++ b/tex/context/base/typo-mar.lua
@@ -557,6 +557,9 @@ end
local function inject(parent,head,candidate)
local box = candidate.box
+ if not box then
+ return head, nil, false -- we can have empty texts
+ end
local width = getfield(box,"width")
local height = getfield(box,"height")
local depth = getfield(box,"depth")
@@ -749,7 +752,9 @@ local function flushed(scope,parent) -- current is hlist
done = true
continue = continue or con
nofstored = nofstored - 1
- registertogether(tonode(parent),room) -- !! tonode
+ if room then
+ registertogether(tonode(parent),room) -- !! tonode
+ end
else
break
end
diff --git a/tex/context/base/typo-pag.lua b/tex/context/base/typo-pag.lua
index 5b96e9c21..53f79fcfc 100644
--- a/tex/context/base/typo-pag.lua
+++ b/tex/context/base/typo-pag.lua
@@ -52,6 +52,9 @@ trackers.register("parbuilders.keeptogether", function(v) trace_keeptogether =
-- when no hlists are there ? ... maybe the local_par
function parbuilders.registertogether(line,specification) -- might change
+ if not specification then
+ return
+ end
if not enabled then
nodes.tasks.enableaction("finalizers","builders.paragraphs.keeptogether")
end
@@ -87,18 +90,16 @@ function parbuilders.registertogether(line,specification) -- might change
if trace_keeptogether then
local a = a or last
local c = cache[a]
- if trace_keeptogether then
- local noflines = specification.lineheight
- local height = c.height
- local depth = c.depth
- local slack = c.slack
- if not noflines or noflines == 0 then
- noflines = "unknown"
- else
- noflines = math.round((height + depth - slack) / noflines)
- end
- report_keeptogether("registered, index %s, height %p, depth %p, slack %p, noflines %a",a,height,depth,slack,noflines)
+ local noflines = specification.lineheight
+ local height = c.height
+ local depth = c.depth
+ local slack = c.slack
+ if not noflines or noflines == 0 then
+ noflines = "unknown"
+ else
+ noflines = math.round((height + depth - slack) / noflines)
end
+ report_keeptogether("registered, index %s, height %p, depth %p, slack %p, noflines %a",a,height,depth,slack,noflines)
end
end
diff --git a/tex/context/base/x-asciimath.lua b/tex/context/base/x-asciimath.lua
index a6883f66c..b3202daa9 100644
--- a/tex/context/base/x-asciimath.lua
+++ b/tex/context/base/x-asciimath.lua
@@ -1260,6 +1260,7 @@ end
-- todo: cache simple ones, say #str < 10, maybe weak
+local context = context
local ctx_mathematics = context and context.mathematics or report_asciimath
local ctx_type = context and context.type or function() end
local ctx_inleft = context and context.inleft or function() end
@@ -1336,6 +1337,9 @@ function collect(fpattern,element,collected,indexed)
filename = gsub(filenames[i],"\\","/")
local splitname = (wildcard and wildcard ~= "" and string.split(filename,wildcard)[2]) or filename
local shortname = gsub(splitname or file.basename(filename),"^%./","")
+ if shortname == "" then
+ shortname = filename
+ end
for s in gmatch(io.loaddata(filename),mpattern) do
local c = cleanedup(s)
local f = collected[c]
@@ -1404,6 +1408,8 @@ end
commands.asciimath = convert
+local context = context
+
if not context then
-- trace_mapping = true
@@ -1462,8 +1468,6 @@ if not context then
end
-local context = context
-
local ctx_typebuffer = context.typebuffer
local ctx_mathematics = context.mathematics
local ctx_color = context.color
@@ -1471,13 +1475,14 @@ local ctx_color = context.color
local sequenced = table.sequenced
local assign_buffer = buffers.assign
-asciimath.show = { }
+local show = { }
+asciimath.show = show
local collected, indexed, ignored = { }, { }, { }
local color = { "darkred" }
-function asciimath.show.ignore(n)
+function show.ignore(n)
if type(n) == "string" then
local c = collected[n]
n = c and c.n
@@ -1487,7 +1492,7 @@ function asciimath.show.ignore(n)
end
end
-function asciimath.show.count(n,showcleanedup)
+function show.count(n,showcleanedup)
local v = collected[indexed[n]]
local count = v.count
local cleanedup = v.cleanedup
@@ -1501,9 +1506,10 @@ function asciimath.show.count(n,showcleanedup)
end
end
-local h = { }
+local h = { }
+local am = { "am" }
-function asciimath.show.nofdirty(n)
+function show.nofdirty(n)
local k = indexed[n]
local v = collected[k]
local n = v.cleanedup
@@ -1518,7 +1524,7 @@ function asciimath.show.nofdirty(n)
context(#h)
end
-function asciimath.show.dirty(m,wrapped)
+function show.dirty(m,wrapped)
local d = h[m]
if d then
ctx_inleft(d[2])
@@ -1527,24 +1533,24 @@ function asciimath.show.dirty(m,wrapped)
else
assign_buffer("am",d[1])
end
- ctx_typebuffer { "am" }
+ ctx_typebuffer(am)
end
end
-function asciimath.show.files(n)
+function show.files(n)
context(sequenced(collected[indexed[n]].files," "))
end
-function asciimath.show.input(n,wrapped)
+function show.input(n,wrapped)
if wrapped then
assign_buffer("am",'"' .. indexed[n] .. '"')
else
assign_buffer("am",indexed[n])
end
- ctx_typebuffer { "am" }
+ ctx_typebuffer(am)
end
-function asciimath.show.result(n)
+function show.result(n)
local v = collected[indexed[n]]
if ignored[n] then
context("ignored")
@@ -1555,7 +1561,7 @@ function asciimath.show.result(n)
end
end
-function asciimath.show.load(str,element)
+function show.load(str,element)
collected, indexed, ignored = { }, { }, { }
local t = utilities.parsers.settings_to_array(str)
for i=1,#t do
@@ -1563,11 +1569,11 @@ function asciimath.show.load(str,element)
end
end
-function asciimath.show.max()
+function show.max()
context(#indexed)
end
-function asciimath.show.statistics()
+function show.statistics()
local usedfiles = { }
local noffiles = 0
local nofokay = 0
@@ -1601,7 +1607,7 @@ function asciimath.show.statistics()
context.stoptabulate()
end
-function asciimath.show.save(name)
+function show.save(name)
table.save(name ~= "" and name or "dummy.lua",collected)
end
diff --git a/tex/context/base/x-asciimath.mkiv b/tex/context/base/x-asciimath.mkiv
index 4eff848e0..d491e5810 100644
--- a/tex/context/base/x-asciimath.mkiv
+++ b/tex/context/base/x-asciimath.mkiv
@@ -199,37 +199,43 @@
\protect
-\continueifinputfile{x-asciimath.mkiv}
+\startsetups asciimath:layout
-%D This will become an extra.
+ \setupbodyfont
+ % [pagella,10pt]
+ [dejavu,10pt]
+
+ \setuplayout
+ [backspace=35mm,
+ leftmargin=20mm,
+ rightmargindistance=0pt,
+ leftmargindistance=5mm,
+ cutspace=1cm,
+ topspace=1cm,
+ bottomspace=1cm,
+ width=middle,
+ height=middle,
+ header=0cm,
+ footer=1cm]
+
+ \setupheadertexts
+ []
-\setupbodyfont
-% [pagella,10pt]
- [dejavu,10pt]
+ \setupfootertexts
+ [\currentdate][\pagenumber]
-\setuplayout
- [backspace=35mm,
- leftmargin=20mm,
- rightmargindistance=0pt,
- leftmargindistance=5mm,
- cutspace=1cm,
- topspace=1cm,
- bottomspace=1cm,
- width=middle,
- height=middle,
- header=0cm,
- footer=1cm]
+ \setupalign
+ [flushleft,verytolerant,stretch]
-\setupheadertexts
- []
+ \dontcomplain
-\setupfootertexts
- [\currentdate][\pagenumber]
+\stopsetups
-\setupalign
- [flushleft,verytolerant,stretch]
+\continueifinputfile{x-asciimath.mkiv}
+
+%D This will become an extra.
-\dontcomplain
+\setups[asciimath:layout]
% \enabletrackers[modules.asciimath.mapping]
% \enabletrackers[modules.asciimath.detail]
diff --git a/tex/context/fonts/treatments.lfg b/tex/context/fonts/treatments.lfg
index 44d24da22..07bb51def 100644
--- a/tex/context/fonts/treatments.lfg
+++ b/tex/context/fonts/treatments.lfg
@@ -26,21 +26,47 @@ local fix_unifraktur = {
}
local fix_lmmonoregular = {
+ --
+ -- there are now some extra safeguards for idris
+ --
comment = "wrong widths of some glyphs",
fixes = function(data)
report("fixing some wrong widths")
local unicodes = data.resources.unicodes
local descriptions = data.descriptions
- local defaultwidth = descriptions[unicodes["zero"]].width
- descriptions[unicodes["six"] ].width = defaultwidth
- descriptions[unicodes["nine"] ].width = defaultwidth
- descriptions[unicodes["caron"] ].width = defaultwidth
- descriptions[unicodes["perthousand"] ].width = defaultwidth
- descriptions[unicodes["numero"] ].width = defaultwidth
- descriptions[unicodes["caron.cap"] ].width = defaultwidth
- descriptions[unicodes["six.taboldstyle"] ].width = defaultwidth
- descriptions[unicodes["nine.taboldstyle"]].width = defaultwidth
- descriptions[unicodes["dollar.oldstyle" ]].width = defaultwidth
+ local function getdescription(name)
+ local unicode = unicodes[name]
+ if not unicode then
+ report("no valid unicode for %a",name)
+ return
+ end
+ local description = descriptions[unicode]
+ if not description then
+ report("no glyph names %a in font",name)
+ return
+ end
+ return description
+ end
+ local zero = getdescription("zero")
+ if not zero then
+ return
+ end
+ local defaultwidth = zero.width
+ local function setwidth(name)
+ local data = getdescription(name)
+ if data then
+ data.width = defaultwidth
+ end
+ end
+ setwidth("six")
+ setwidth("nine")
+ setwidth("caron")
+ setwidth("perthousand")
+ setwidth("numero")
+ setwidth("caron.cap")
+ setwidth("six.taboldstyle")
+ setwidth("nine.taboldstyle")
+ setwidth("dollar.oldstyle")
end
}
diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua
index 2b7b84101..8f57859c1 100644
--- a/tex/generic/context/luatex/luatex-fonts-merged.lua
+++ b/tex/generic/context/luatex/luatex-fonts-merged.lua
@@ -1,6 +1,6 @@
-- merged file : luatex-fonts-merged.lua
-- parent file : luatex-fonts.lua
--- merge date : 06/22/14 19:58:56
+-- merge date : 06/25/14 19:46:20
do -- begin closure to overcome local limits and interference