summaryrefslogtreecommitdiff
path: root/tex/context/base
diff options
context:
space:
mode:
authorContext Git Mirror Bot <phg42.2a@gmail.com>2015-08-13 20:15:07 +0200
committerContext Git Mirror Bot <phg42.2a@gmail.com>2015-08-13 20:15:07 +0200
commitce5f19af64d3127dd778171a9d2d00b1e2a3cbde (patch)
treebbaf50cce6c0c004051e5c2f39604f7f0134c15e /tex/context/base
parent66db77c6c85c275101199dac3fead77cf6ef4315 (diff)
downloadcontext-ce5f19af64d3127dd778171a9d2d00b1e2a3cbde.tar.gz
2015-08-13 19:35:00
Diffstat (limited to 'tex/context/base')
-rw-r--r--tex/context/base/cont-new.mkiv2
-rw-r--r--tex/context/base/context-version.pdfbin4209 -> 4207 bytes
-rw-r--r--tex/context/base/context.mkiv2
-rw-r--r--tex/context/base/math-noa.lua14
-rw-r--r--tex/context/base/page-lin.lua54
-rw-r--r--tex/context/base/page-lin.mkvi4
-rw-r--r--tex/context/base/spac-ver.mkiv138
-rw-r--r--tex/context/base/status-files.pdfbin24453 -> 24443 bytes
-rw-r--r--tex/context/base/status-lua.pdfbin255546 -> 255545 bytes
-rw-r--r--tex/context/base/trac-vis.lua2
-rw-r--r--tex/context/base/typo-mar.lua3
-rw-r--r--tex/context/base/x-asciimath.lua87
12 files changed, 205 insertions, 101 deletions
diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv
index 9e4040348..79f735968 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{2015.08.11 17:29}
+\newcontextversion{2015.08.13 19:33}
%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 ba019303e..6d45b9ee1 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 2ed90c88c..42e1268f8 100644
--- a/tex/context/base/context.mkiv
+++ b/tex/context/base/context.mkiv
@@ -39,7 +39,7 @@
%D up and the dependencies are more consistent.
\edef\contextformat {\jobname}
-\edef\contextversion{2015.08.11 17:29}
+\edef\contextversion{2015.08.13 19:33}
\edef\contextkind {beta}
%D For those who want to use this:
diff --git a/tex/context/base/math-noa.lua b/tex/context/base/math-noa.lua
index 6d3662b8f..e3ff3c396 100644
--- a/tex/context/base/math-noa.lua
+++ b/tex/context/base/math-noa.lua
@@ -691,15 +691,21 @@ end
local a_autofence = privateattribute("mathautofence")
local autofences = { }
processors.autofences = autofences
+local dummyfencechar = 0x2E
local function makefence(what,char)
local d = new_node(math_delim)
local f = new_node(math_fence)
if char then
- local c = getfield(char,"nucleus")
- setfield(d,"small_char",getfield(c,"char"))
- setfield(d,"small_fam", getfield(c,"fam"))
- free_node(c)
+ local sym = getfield(char,"nucleus")
+ local chr = getfield(sym,"char")
+ local fam = getfield(sym,"fam")
+ if chr == dummyfencechar then
+ chr = 0
+ end
+ setfield(d,"small_char",chr)
+ setfield(d,"small_fam", fam)
+ free_node(sym)
end
setfield(f,"subtype",what)
setfield(f,"delim",d)
diff --git a/tex/context/base/page-lin.lua b/tex/context/base/page-lin.lua
index d2476b2da..73dba30b6 100644
--- a/tex/context/base/page-lin.lua
+++ b/tex/context/base/page-lin.lua
@@ -237,7 +237,7 @@ local function check_number(n,a,skip,sameline)
report_lines("skipping line number %s for setup %a: %s (%s)",#current_list,a,s,d.continue or v_no)
end
end
- ctx_makelinenumber(tag,skipflag,s,getfield(n,"shift"),getfield(n,"width"),leftmarginwidth(getlist(n)),getfield(n,"dir"))
+ ctx_makelinenumber(tag,skipflag,s,getfield(n,"width"),getfield(n,"dir"))
end
end
@@ -357,6 +357,38 @@ end
-- setfield(h,"list",ti) -- the number
-- setfield(n,"list",h)
+-- function boxed.stage_two(n,m)
+-- if #current_list > 0 then
+-- m = m or lines.scratchbox
+-- local t, tn = { }, 0
+-- for l in traverse_id(hlist_code,getlist(getbox(m))) do
+-- tn = tn + 1
+-- t[tn] = copy_node(l) -- use take_box instead
+-- end
+-- for i=1,#current_list do
+-- local li = current_list[i]
+-- local n, m, ti = li[1], li[2], t[i]
+-- if ti then
+-- local d = getfield(n,"dir")
+-- local l = getlist(n)
+-- if d == "TRT" then
+-- local w = getfield(n,"width")
+-- ti = hpack_nodes(linked_nodes(new_kern(-w),ti,new_kern(w)))
+-- end
+-- setfield(ti,"next",l)
+-- setfield(l,"prev",ti)
+-- setfield(n,"list",ti)
+-- resolve(n,m)
+-- else
+-- report_lines("error in linenumbering (1)")
+-- return
+-- end
+-- end
+-- end
+-- end
+
+local addtoline = typesetters.paragraphs and typesetters.paragraphs.addtoline
+
function boxed.stage_two(n,m)
if #current_list > 0 then
m = m or lines.scratchbox
@@ -369,15 +401,19 @@ function boxed.stage_two(n,m)
local li = current_list[i]
local n, m, ti = li[1], li[2], t[i]
if ti then
- local d = getfield(n,"dir")
- local l = getlist(n)
- if d == "TRT" then
- local w = getfield(n,"width")
- ti = hpack_nodes(linked_nodes(new_kern(-w),ti,new_kern(w)))
+ if addtoline then
+ addtoline(n,ti)
+ else
+ local d = getfield(n,"dir")
+ local l = getlist(n)
+ if d == "TRT" then
+ local w = getfield(n,"width")
+ ti = hpack_nodes(linked_nodes(new_kern(-w),ti,new_kern(w)))
+ end
+ setfield(ti,"next",l)
+ setfield(l,"prev",ti)
+ setfield(n,"list",ti)
end
- setfield(ti,"next",l)
- setfield(l,"prev",ti)
- setfield(n,"list",ti)
resolve(n,m)
else
report_lines("error in linenumbering (1)")
diff --git a/tex/context/base/page-lin.mkvi b/tex/context/base/page-lin.mkvi
index 4b87b335a..d7bdd0050 100644
--- a/tex/context/base/page-lin.mkvi
+++ b/tex/context/base/page-lin.mkvi
@@ -64,7 +64,7 @@
% tag skipflag s getfield(n,"shift") getfield(n,"width") leftmarginwidth(getlist(n)) getfield(n,"dir"))
-\let\makelinenumber\gobblesevenarguments % used at lua end
+\let\makelinenumber\gobblefivearguments % used at lua end
\newconditional\page_postprocessors_needed_box
@@ -326,7 +326,7 @@
\relax
\egroup}
-\def\page_lines_make_number#tag#mode#linenumber#shift#width#leftskip#dir% beware, one needs so compensate for this in the \hsize
+\def\page_lines_make_number#tag#mode#linenumber#width#dir% with hang and parindent and skips we have to compensatefor \hsize
{\naturalhbox to \zeropoint \bgroup
\ifcase#mode\relax
% \settrue \c_page_lines_fake_number
diff --git a/tex/context/base/spac-ver.mkiv b/tex/context/base/spac-ver.mkiv
index 86a731d3c..0e1b0cc89 100644
--- a/tex/context/base/spac-ver.mkiv
+++ b/tex/context/base/spac-ver.mkiv
@@ -487,33 +487,22 @@
%
% todo: a version that works ok inside a box
+% global : outer hsize + keep skips
+% local : inner hsize + reset skips
+
\installcorenamespace{linesaround}
+\let\spac_lines_vbox\vbox
+
+\installtextracker
+ {linecorrection.boxes}
+ {\let\spac_lines_vbox\ruledvbox}
+ {\let\spac_lines_vbox\vbox}
+
\let\v_spac_lines_around_action_set\relax
\let\m_spac_lines_around \empty
-% \setvalue{\??linesaround\v!blank }{\blank}
-% \letvalue{\??linesaround\empty }\relax
-% \setvalue{\??linesaround\s!unknown}{\blank[\m_spac_lines_around]}
-%
-% \unexpanded\def\startlinecorrection
-% {\bgroup
-% \dodoubleempty\spac_lines_start_correction}
-%
-% \def\spac_lines_start_correction[#1][#2]% #2 gobbles spaces
-% {\edef\m_spac_lines_around{#1}%
-% \expandafter\let\expandafter\spac_lines_action_around\csname\??linesaround
-% \ifcsname\??linesaround\m_spac_lines_around\endcsname\m_spac_lines_around\else\s!unknown\fi
-% \endcsname
-% \spac_lines_action_around
-% \startbaselinecorrection
-% \offbaselinecorrection
-% \ignorespaces}
-%
-% \unexpanded\def\stoplinecorrection
-% {\stopbaselinecorrection
-% \spac_lines_action_around
-% \egroup}
+\newconstant\c_spac_lines_correction_mode
\setvalue{\??linesaround\v!blank }{\blank}
\letvalue{\??linesaround\empty }\relax
@@ -526,62 +515,61 @@
\unexpanded\def\startlinecorrection
{\endgraf
- \bgroup
+ \begingroup
+ \setconstant\c_spac_lines_correction_mode\plusone
\dosingleempty\spac_lines_start_correction}
\unexpanded\def\startlocallinecorrection
{\endgraf
- \bgroup
- \setlocalhsize
- \hsize\localhsize
+ \begingroup
+ \setconstant\c_spac_lines_correction_mode\plustwo
\dosingleempty\spac_lines_start_correction}
-\def\spac_lines_start_correction
- {\ifvmode
- \expandafter\spac_lines_start_correction_yes
- \else
- \expandafter\spac_lines_start_correction_nop
- \fi}
-
-\def\spac_lines_start_correction_nop[#1]%
- {\vbox\bgroup
- \ignorespaces
- \let\spac_lines_stop_correction\spac_lines_stop_correction_nop}
-
-\def\spac_lines_stop_correction_nop
- {\removeunwantedspaces
- \egroup}
-
-\def\spac_lines_start_correction_yes[#1]%
+\unexpanded\def\spac_lines_start_correction[#1]%
{\edef\m_spac_lines_around{#1}%
\spac_lines_action_around
\d_spac_prevdepth\prevdepth
\spac_lines_initialize_corrections
\offbaselinecorrection % ???
- \setbox\scratchbox\vbox\bgroup
- \ignorespaces
- \let\spac_lines_stop_correction\spac_lines_stop_correction_yes}
-
-% still not ok ... will move to the lua end ... needs a final solution
+ \setbox\scratchbox\spac_lines_vbox\bgroup
+ \ifcase\c_spac_lines_correction_mode
+ % nothing
+ \or
+ % global
+ \or
+ % local
+ \setlocalhsize
+ \hsize\localhsize
+ \forgetbothskips
+ \fi
+ \ignorespaces}
-\unexpanded\def\spac_lines_stop_correction_yes
+\unexpanded\def\spac_lines_stop_correction
{\removeunwantedspaces
\egroup
\ifgridsnapping
- \blank[\v!white]%
- \snaptogrid\hbox{\box\scratchbox}%
+ \spac_lines_stop_correction_ongrid
\else
-\blank[\v!nowhite]%
-\ifdim\parskip>\zeropoint
- % too fuzzy otherwise
-\else
- % doesn't like whitespace
+ \spac_lines_stop_correction_normal
+ \fi
+ \endgroup}
+
+\unexpanded\def\spac_lines_stop_correction_ongrid
+ {\blank[\v!white]%
+ \snaptogrid\hbox{\box\scratchbox}}
+
+\unexpanded\def\spac_lines_stop_correction_normal
+ {\blank[\v!nowhite]%
+ \ifdim\parskip>\zeropoint
+ % too fuzzy otherwise
+ \else
+ % doesn't like whitespace
\ifdim\d_spac_prevdepth<\maxdimen
\unless\ifdim\d_spac_prevdepth<\zeropoint
\ifdim\d_spac_prevdepth<\strutdp \relax
\pushlastnode
\ifdim\d_spac_prevdepth>\zeropoint
- \kern-\d_spac_prevdepth
+ \kern-\d_spac_prevdepth
\fi
\kern\strutdp
\prevdepth\strutdp
@@ -589,24 +577,30 @@
\fi
\fi
\fi
-\fi
- \ifdim\pagegoal<\maxdimen
- \blank[\v!white,\the\d_spac_lines_correction_before]% \blank[\v!white]\dotopbaselinecorrection
- \fi
- \nointerlineskip % new
- \noindent % not just \dontleavehmode (MKII compatible)
- \box\scratchbox
- \endgraf
- \blank[\the\d_spac_lines_correction_after]% \dobotbaselinecorrection
- % \allowbreak % new, otherwise problems when many in a row
- \prevdepth\strutdp
\fi
- \spac_lines_action_around
- \egroup}
+ \ifdim\pagegoal<\maxdimen
+ \blank[\v!white,\the\d_spac_lines_correction_before]% \blank[\v!white]\dotopbaselinecorrection
+ \fi
+ \nointerlineskip % new
+ \noindent % not \dontleavehmode !
+ \ifcase\c_spac_lines_correction_mode
+ % nothing
+ \or
+ % global
+ \hskip-\leftskip % more tricky would be hangindent so we ignore that one
+ \or
+ % local
+ \fi
+ \box\scratchbox
+ \endgraf
+ \blank[\the\d_spac_lines_correction_after]% \dobotbaselinecorrection
+ % \allowbreak % new, otherwise problems when many in a row
+ \prevdepth\strutdp
+ \spac_lines_action_around}
-\unexpanded\def\stoplinecorrection{\spac_lines_stop_correction}
-\let\stoplocallinecorrection\stoplinecorrection
+\let\stoplinecorrection \spac_lines_stop_correction
+\let\stoplocallinecorrection\spac_lines_stop_correction
% todo:
diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf
index d00f7e0c0..9fd48c870 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 cce7cb7b7..ce53e6064 100644
--- a/tex/context/base/status-lua.pdf
+++ b/tex/context/base/status-lua.pdf
Binary files differ
diff --git a/tex/context/base/trac-vis.lua b/tex/context/base/trac-vis.lua
index a29913fce..47dcdd825 100644
--- a/tex/context/base/trac-vis.lua
+++ b/tex/context/base/trac-vis.lua
@@ -301,7 +301,7 @@ trackers .register("visualizers.reset", function(v) set("reset", v) end)
trackers .register("visualizers.all", function(v) set("all", v) end)
trackers .register("visualizers.makeup", function(v) set("makeup",v) end)
trackers .register("visualizers.boxes", function(v) set("boxes", v) end)
-directives.register("visualizers.fraction", function(v) fraction = v and tonumber(v) or 10 end)
+directives.register("visualizers.fraction", function(v) fraction = (v and tonumber(v)) or (v == "more" and 5) or 10 end)
local c_positive = "trace:b"
local c_negative = "trace:r"
diff --git a/tex/context/base/typo-mar.lua b/tex/context/base/typo-mar.lua
index 5829174b3..39ac9e140 100644
--- a/tex/context/base/typo-mar.lua
+++ b/tex/context/base/typo-mar.lua
@@ -263,7 +263,7 @@ end
function margins.save(t)
setmetatable(t,defaults)
local content = getbox(t.number)
-setattr(content,a_specialcontent,1)
+setattr(content,a_specialcontent,1) -- todo: a property
local location = t.location
local category = t.category
local inline = t.inline
@@ -681,6 +681,7 @@ local function inject(parent,head,candidate)
end
setfield(box,"shift",shift)
setfield(box,"width",0)
+-- print(head)
if not head then
head = box
elseif getid(head) == whatsit_code and getsubtype(head) == localpar_code then
diff --git a/tex/context/base/x-asciimath.lua b/tex/context/base/x-asciimath.lua
index d1dab7dd9..e1a4e15a1 100644
--- a/tex/context/base/x-asciimath.lua
+++ b/tex/context/base/x-asciimath.lua
@@ -103,13 +103,13 @@ local reserved = {
["max"] = { false, "\\max" },
["ln"] = { false, "\\ln" },
- ["atan"] = { false, "\\atan" }, -- extra
- ["acos"] = { false, "\\acos" }, -- extra
- ["asin"] = { false, "\\asin" }, -- extra
- -- extra
- ["arctan"] = { false, "\\arctan" }, -- extra
- ["arccos"] = { false, "\\arccos" }, -- extra
- ["arcsin"] = { false, "\\arcsin" }, -- extra
+ ["atan"] = { false, "\\atan" }, -- extra
+ ["acos"] = { false, "\\acos" }, -- extra
+ ["asin"] = { false, "\\asin" }, -- extra
+
+ ["arctan"] = { false, "\\arctan" }, -- extra
+ ["arccos"] = { false, "\\arccos" }, -- extra
+ ["arcsin"] = { false, "\\arcsin" }, -- extra
["and"] = { false, "\\text{and}" },
["or"] = { false, "\\text{or}" },
@@ -117,7 +117,7 @@ local reserved = {
["sqrt"] = { false, "\\asciimathsqrt", "unary" },
["root"] = { false, "\\asciimathroot", "binary" },
--- ["\\frac"] = { false, "\\frac", "binary" },
+ -- ["\\frac"] = { false, "\\frac", "binary" },
["frac"] = { false, "\\frac", "binary" },
["stackrel"] = { false, "\\asciimathstackrel", "binary" },
["hat"] = { false, "\\widehat", "unary" },
@@ -737,7 +737,7 @@ local isbinary = {
["\\asciimathstackrel"] = true,
}
-local isunary = {
+local isunary = { -- can be taken from reserved
["\\sqrt"] = true,
["\\asciimathsqrt"] = true,
["\\text"] = true, -- mathoptext
@@ -764,6 +764,40 @@ local isinfix = {
["_"] = true,
}
+local isstupid = {
+ ["\\prod"] = true,
+ ["\\sinh"] = true,
+ ["\\cosh"] = true,
+ ["\\tanh"] = true,
+ ["\\sum"] = true,
+ ["\\int"] = true,
+ ["\\sin"] = true,
+ ["\\cos"] = true,
+ ["\\tan"] = true,
+ ["\\csc"] = true,
+ ["\\sec"] = true,
+ ["\\cot"] = true,
+ ["\\log"] = true,
+ ["\\det"] = true,
+ ["\\lim"] = true,
+ ["\\mod"] = true,
+ ["\\gcd"] = true,
+ ["\\min"] = true,
+ ["\\max"] = true,
+ ["\\ln"] = true,
+
+ ["\\atan"] = true,
+ ["\\acos"] = true,
+ ["\\asin"] = true,
+ true,
+ ["\\arctan"] = true,
+ ["\\arccos"] = true,
+ ["\\arcsin"] = true,
+
+ ["f"] = true,
+ ["g"] = true,
+}
+
local isleft = {
[s_lparent] = true,
[s_lbrace] = true,
@@ -1306,6 +1340,38 @@ local function collapse_parentheses(t)
return t
end
+local function collapse_stupids(t)
+ local n, m, i = #t, 0, 1
+ while i <= n do
+ m = m + 1
+ local current = t[i]
+ if isstupid[current] then
+ local one = t[i+1]
+ if type(one) == "table" then
+ one = collapse(one,level)
+ t[m] = current .. "{" .. one .. "}"
+ i = i + 2
+ else
+ t[m] = current
+ i = i + 1
+ end
+ else
+ t[m] = current
+ i = i + 1
+ end
+ end
+ if i == n then -- yes?
+ m = m + 1
+ t[m] = t[n]
+ end
+ if m < n then
+ for i=n,m+1,-1 do
+ t[i] = nil
+ end
+ end
+ return t
+end
+
local function collapse_signs(t)
local n, m, i = #t, 0, 1
while i <= n do
@@ -1316,7 +1382,7 @@ local function collapse_signs(t)
if not one then
-- m = m + 1
t[m] = current .. "{}" -- error
-return t
+ return t
-- break
end
if type(one) == "table" then
@@ -1662,6 +1728,7 @@ collapse = function(t,level)
-- steps
t = collapse_matrices (t) if trace_detail then show_state(t,level,"matrices") end
t = collapse_bars (t) if trace_detail then show_state(t,level,"bars") end
+t = collapse_stupids (t) if trace_detail then show_state(t,level,"stupids") end
t = collapse_pairs (t) if trace_detail then show_state(t,level,"pairs") end
t = collapse_parentheses(t) if trace_detail then show_state(t,level,"parentheses") end
t = collapse_signs (t) if trace_detail then show_state(t,level,"signs") end