summaryrefslogtreecommitdiff
path: root/tex
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2012-12-01 13:03:00 +0100
committerHans Hagen <pragma@wxs.nl>2012-12-01 13:03:00 +0100
commit03f30f37cef77f804f8e86103b2e9d1b36992081 (patch)
tree8bf25e03ec1a5f942c0929d91129d6fdf6a475c4 /tex
parent7ea40dde6618c80b4404c88b4a95c7deab6fc307 (diff)
downloadcontext-03f30f37cef77f804f8e86103b2e9d1b36992081.tar.gz
beta 2012.12.01 13:03
Diffstat (limited to 'tex')
-rw-r--r--tex/context/base/char-def.lua2
-rw-r--r--tex/context/base/cont-new.mkii2
-rw-r--r--tex/context/base/cont-new.mkiv2
-rw-r--r--tex/context/base/context-version.pdfbin4105 -> 4096 bytes
-rw-r--r--tex/context/base/context-version.pngbin40634 -> 39869 bytes
-rw-r--r--tex/context/base/context.mkii2
-rw-r--r--tex/context/base/context.mkiv2
-rw-r--r--tex/context/base/math-ini.mkiv113
-rw-r--r--tex/context/base/math-noa.lua176
-rw-r--r--tex/context/base/status-files.pdfbin24456 -> 24405 bytes
-rw-r--r--tex/context/base/status-lua.pdfbin199606 -> 199574 bytes
-rw-r--r--tex/context/base/task-ini.lua2
-rw-r--r--tex/generic/context/luatex/luatex-fonts-merged.lua2
13 files changed, 232 insertions, 71 deletions
diff --git a/tex/context/base/char-def.lua b/tex/context/base/char-def.lua
index 6c73cf008..25e5f621c 100644
--- a/tex/context/base/char-def.lua
+++ b/tex/context/base/char-def.lua
@@ -437,6 +437,8 @@ characters.data={
direction="cs",
linebreak="is",
mathclass="ord",
+ mathclass="punctuation",
+ comment = "class needed for autopunctuation",
mathspec={
-- {
-- class="ord",
diff --git a/tex/context/base/cont-new.mkii b/tex/context/base/cont-new.mkii
index 916fb902a..e30e80c81 100644
--- a/tex/context/base/cont-new.mkii
+++ b/tex/context/base/cont-new.mkii
@@ -11,7 +11,7 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-\newcontextversion{2012.11.30 22:53}
+\newcontextversion{2012.12.01 13:03}
%D This file is loaded at runtime, thereby providing an
%D excellent place for hacks, patches, extensions and new
diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv
index 2dbe71608..bbf02d0e3 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{2012.11.30 22:53}
+\newcontextversion{2012.12.01 13:03}
%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 d645699d0..d71e00a45 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-version.png b/tex/context/base/context-version.png
index fe72b4e98..62a4660bd 100644
--- a/tex/context/base/context-version.png
+++ b/tex/context/base/context-version.png
Binary files differ
diff --git a/tex/context/base/context.mkii b/tex/context/base/context.mkii
index 98f34d94b..d820b053b 100644
--- a/tex/context/base/context.mkii
+++ b/tex/context/base/context.mkii
@@ -20,7 +20,7 @@
%D your styles an modules.
\edef\contextformat {\jobname}
-\edef\contextversion{2012.11.30 22:53}
+\edef\contextversion{2012.12.01 13:03}
%D For those who want to use this:
diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv
index 3f965044a..d05a50ad0 100644
--- a/tex/context/base/context.mkiv
+++ b/tex/context/base/context.mkiv
@@ -25,7 +25,7 @@
%D up and the dependencies are more consistent.
\edef\contextformat {\jobname}
-\edef\contextversion{2012.11.30 22:53}
+\edef\contextversion{2012.12.01 13:03}
%D For those who want to use this:
diff --git a/tex/context/base/math-ini.mkiv b/tex/context/base/math-ini.mkiv
index adf63004c..baa6c9593 100644
--- a/tex/context/base/math-ini.mkiv
+++ b/tex/context/base/math-ini.mkiv
@@ -876,21 +876,118 @@
%D
%D \blank{\getbuffer}\blank
-\newconditional\automathpunctuation
+% \newconditional\automathpunctuation
+%
+% \unexpanded\def\enablemathpunctuation {\settrue \automathpunctuation}
+% \unexpanded\def\disablemathpunctuation{\setfalse\automathpunctuation}
+%
+% \appendtoks
+% \doifelse{\mathematicsparameter\v!autopunctuation}\v!yes\settrue\setfalse\automathpunctuation
+% \to \everyswitchmathematics
+%
+% \setupmathematics
+% [\v!autopunctuation=\v!no]
+%
+% \def\math_punctuation_next{\ifx\nexttoken\blankspace\char\zerocount\fi}
+%
+% \unexpanded\def\math_punctuation_comma {\textcomma \futurelet\nexttoken\math_punctuation_next}
+% \unexpanded\def\math_punctuation_period{\textperiod\futurelet\nexttoken\math_punctuation_next}
+%
+% \setnewconstant\c_math_comma "002C
+% \setnewconstant\c_math_period "002E
+% \setnewconstant\c_math_special"8000
+%
+% \bgroup
+%
+% \catcode\c_math_comma \activecatcode
+% \catcode\c_math_period\activecatcode
+%
+% \unexpanded\gdef\math_punctuation_initialize_indeed
+% {\mathcode\c_math_comma \c_math_special
+% \mathcode\c_math_period\c_math_special
+% \let,\math_punctuation_comma
+% \let.\math_punctuation_period
+% \attribute\mathpunctuationattribute\plustwo}
+%
+% \unexpanded\gdef\math_punctuation_initialize_yes
+% {\attribute\mathpunctuationattribute\plustwo}
+%
+% \unexpanded\gdef\math_punctuation_initialize_nop
+% {\attribute\mathpunctuationattribute\plusone}
+%
+% \egroup
+%
+% \appendtoks
+% \ifconditional\automathpunctuation
+% \math_punctuation_initialize_indeed
+% \math_punctuation_initialize_yes
+% \let\enablemathpunctuation \math_punctuation_initialize_yes
+% \let\disablemathpunctuation\math_punctuation_initialize_nop
+% \fi
+% \to \everymathematics
-\unexpanded\def\enablemathpunctuation {\settrue \automathpunctuation}
-\unexpanded\def\disablemathpunctuation{\setfalse\automathpunctuation}
+% Later I will look again into a \LUATEX\ based solution. It only makes sense
+% to delegate to \LUA\ when we have more variants and need analysis (experimental
+% trickery removed for a while).
-\appendtoks
- \doifelse{\mathematicsparameter\v!autopunctuation}\v!yes\settrue\setfalse\automathpunctuation
-\to \everyswitchmathematics
+\def\math_punctuation_comma_next {\ifx\nexttoken\blankspace \mathpunct{\textcomma }\else\mathord{\textcomma }\fi}
+\def\math_punctuation_period_next{\ifx\nexttoken\blankspace \mathpunct{\textperiod}\else\mathord{\textperiod}\fi}
+
+\unexpanded\def\math_punctuation_nop_comma {\mathpunct{\textcomma}}
+\unexpanded\def\math_punctuation_all_comma {\futurelet\nexttoken\math_punctuation_comma_next}
+ \let\math_punctuation_yes_comma \math_punctuation_all_comma
+
+\unexpanded\def\math_punctuation_nop_period{\mathord{\textperiod}}
+\unexpanded\def\math_punctuation_all_period{\futurelet\nexttoken\math_punctuation_period_next}
+ \let\math_punctuation_yes_period\math_punctuation_nop_period
+
+\setnewconstant\c_math_comma "002C
+\setnewconstant\c_math_period "002E
+\setnewconstant\c_math_special"8000
+
+\installcorenamespace {mathautopunctuation}
+
+\bgroup
+
+ \catcode\c_math_comma \activecatcode
+ \catcode\c_math_period\activecatcode
+
+ \setgvalue{\??mathautopunctuation\v!no}%
+ {\let,\math_punctuation_nop_comma
+ \let.\math_punctuation_nop_period}
+
+ \setgvalue{\??mathautopunctuation\v!yes}%
+ {\let,\math_punctuation_yes_comma
+ \let.\math_punctuation_yes_period}
+
+ \setgvalue{\??mathautopunctuation\v!all}%
+ {\let,\math_punctuation_all_comma
+ \let.\math_punctuation_all_period}
+
+\egroup
+
+% \appendtoks
+% \global\mathcode\c_math_comma \c_math_special
+% \global\mathcode\c_math_period\c_math_special
+% \to \everyjob
\appendtoks
- \ifconditional\automathpunctuation\attribute\mathpunctuationattribute\plusone\fi
+ \mathcode\c_math_comma \c_math_special
+ \mathcode\c_math_period\c_math_special
+ \csname\??mathautopunctuation\mathematicsparameter\v!autopunctuation\endcsname
\to \everymathematics
+\appendtoks
+ \ifcsname\??mathautopunctuation\mathematicsparameter\v!autopunctuation\endcsname \else
+ \letmathematicsparameter\v!autopunctuation\v!no
+ \fi
+\to \everysetupmathematics
+
+\def\enablemathpunctuation {\csname\??mathautopunctuation\v!no \endcsname}
+\def\disablemathpunctuation{\csname\??mathautopunctuation\v!yes\endcsname}
+
\setupmathematics
- [\v!autopunctuation=\v!no]
+ [\v!autopunctuation=\v!no] % no | yes | all
%D \macros
%D {mathstyle}
diff --git a/tex/context/base/math-noa.lua b/tex/context/base/math-noa.lua
index 8716ac726..3a04645d1 100644
--- a/tex/context/base/math-noa.lua
+++ b/tex/context/base/math-noa.lua
@@ -78,6 +78,8 @@ local variables = interfaces.variables
local texattribute = tex.attribute
local unsetvalue = attributes.unsetvalue
+local chardata = characters.data
+
noads = noads or { } -- todo: only here
local noads = noads
@@ -366,66 +368,126 @@ end
-- respacing
-local mathpunctuation = attributes.private("mathpunctuation")
-
-local respace = { } processors.respace = respace
-
-local chardata = characters.data
+-- local mathpunctuation = attributes.private("mathpunctuation")
+--
+-- local respace = { } processors.respace = respace
-- only [nd,ll,ul][po][nd,ll,ul]
-respace[math_char] = function(pointer,what,n,parent) -- not math_noad .. math_char ... and then parent
- pointer = parent
- if pointer and pointer.subtype == noad_ord then
- local a = has_attribute(pointer,mathpunctuation)
- if a and a > 0 then
- set_attribute(pointer,mathpunctuation,0)
- local current_nucleus = pointer.nucleus
- if current_nucleus.id == math_char then
- local current_char = current_nucleus.char
- local fc = chardata[current_char]
- fc = fc and fc.category
- if fc == "nd" or fc == "ll" or fc == "lu" then
- local next_noad = pointer.next
- if next_noad and next_noad.id == math_noad and next_noad.subtype == noad_punct then
- local next_nucleus = next_noad.nucleus
- if next_nucleus.id == math_char then
- local next_char = next_nucleus.char
- local nc = chardata[next_char]
- nc = nc and nc.category
- if nc == "po" then
- local last_noad = next_noad.next
- if last_noad and last_noad.id == math_noad and last_noad.subtype == noad_ord then
- local last_nucleus = last_noad.nucleus
- if last_nucleus.id == math_char then
- local last_char = last_nucleus.char
- local lc = chardata[last_char]
- lc = lc and lc.category
- if lc == "nd" or lc == "ll" or lc == "lu" then
- local ord = new_node(math_noad) -- todo: pool
- ord.subtype, ord.nucleus, ord.sub, ord.sup, ord.attr = noad_ord, next_noad.nucleus, next_noad.sub, next_noad.sup, next_noad.attr
- -- next_noad.nucleus, next_noad.sub, next_noad.sup, next_noad.attr = nil, nil, nil, nil
- next_noad.nucleus, next_noad.sub, next_noad.sup = nil, nil, nil -- else crash with attributes ref count
- --~ next_noad.attr = nil
- ord.next = last_noad
- pointer.next = ord
- free_node(next_noad)
- end
- end
- end
- end
- end
- end
- end
- end
- end
- end
-end
-
-function handlers.respace(head,style,penalties)
- processnoads(head,respace,"respace")
- return true
-end
+-- respace[math_char] = function(pointer,what,n,parent) -- not math_noad .. math_char ... and then parent
+-- pointer = parent
+-- if pointer and pointer.subtype == noad_ord then
+-- local a = has_attribute(pointer,mathpunctuation)
+-- if a and a > 0 then
+-- set_attribute(pointer,mathpunctuation,0)
+-- local current_nucleus = pointer.nucleus
+-- if current_nucleus.id == math_char then
+-- local current_char = current_nucleus.char
+-- local fc = chardata[current_char]
+-- fc = fc and fc.category
+-- if fc == "nd" or fc == "ll" or fc == "lu" then
+-- local next_noad = pointer.next
+-- if next_noad and next_noad.id == math_noad and next_noad.subtype == noad_punct then
+-- local next_nucleus = next_noad.nucleus
+-- if next_nucleus.id == math_char then
+-- local next_char = next_nucleus.char
+-- local nc = chardata[next_char]
+-- nc = nc and nc.category
+-- if nc == "po" then
+-- local last_noad = next_noad.next
+-- if last_noad and last_noad.id == math_noad and last_noad.subtype == noad_ord then
+-- local last_nucleus = last_noad.nucleus
+-- if last_nucleus.id == math_char then
+-- local last_char = last_nucleus.char
+-- local lc = chardata[last_char]
+-- lc = lc and lc.category
+-- if lc == "nd" or lc == "ll" or lc == "lu" then
+-- local ord = new_node(math_noad) -- todo: pool
+-- ord.subtype, ord.nucleus, ord.sub, ord.sup, ord.attr = noad_ord, next_noad.nucleus, next_noad.sub, next_noad.sup, next_noad.attr
+-- -- next_noad.nucleus, next_noad.sub, next_noad.sup, next_noad.attr = nil, nil, nil, nil
+-- next_noad.nucleus, next_noad.sub, next_noad.sup = nil, nil, nil -- else crash with attributes ref count
+-- --~ next_noad.attr = nil
+-- ord.next = last_noad
+-- pointer.next = ord
+-- free_node(next_noad)
+-- end
+-- end
+-- end
+-- end
+-- end
+-- end
+-- end
+-- end
+-- end
+-- end
+-- end
+
+-- local comma = 0x002C
+-- local period = 0x002E
+--
+-- respace[math_char] = function(pointer,what,n,parent)
+-- pointer = parent
+-- if pointer and pointer.subtype == noad_punct then
+-- local current_nucleus = pointer.nucleus
+-- if current_nucleus.id == math_char then
+-- local current_nucleus = pointer.nucleus
+-- if current_nucleus.id == math_char then
+-- local current_char = current_nucleus.char
+-- local a = has_attribute(pointer,mathpunctuation)
+-- if not a or a == 0 then
+-- if current_char == comma then
+-- -- default tex: 2,5 or 2, 5 --> 2, 5
+-- elseif current_char == period then
+-- -- default tex: 2.5 or 2. 5 --> 2.5
+-- pointer.subtype = noad_ord
+-- end
+-- elseif a == 1 then
+-- local next_noad = pointer.next
+-- if next_noad and next_noad.id == math_noad then
+-- local next_nucleus = next_noad.nucleus
+-- if next_nucleus.id == math_char and next_nucleus.char == 0 then
+-- nodes.remove(pointer,next_noad,true)
+-- end
+-- if current_char == comma then
+-- -- default tex: 2,5 or 2, 5 --> 2, 5
+-- elseif current_char == period then
+-- -- default tex: 2.5 or 2. 5 --> 2.5
+-- pointer.subtype = noad_ord
+-- end
+-- end
+-- elseif a == 2 then
+-- if current_char == comma or current_char == period then
+-- local next_noad = pointer.next
+-- if next_noad and next_noad.id == math_noad then
+-- local next_nucleus = next_noad.nucleus
+-- if next_nucleus.id == math_char and next_nucleus.char == 0 then
+-- if current_char == comma then
+-- -- adaptive: 2, 5 --> 2, 5
+-- elseif current_char == period then
+-- -- adaptive: 2. 5 --> 2. 5
+-- end
+-- nodes.remove(pointer,next_noad,true)
+-- else
+-- if current_char == comma then
+-- -- adaptive: 2,5 --> 2,5
+-- pointer.subtype = noad_ord
+-- elseif current_char == period then
+-- -- adaptive: 2.5 --> 2.5
+-- pointer.subtype = noad_ord
+-- end
+-- end
+-- end
+-- end
+-- end
+-- end
+-- end
+-- end
+-- end
+--
+-- function handlers.respace(head,style,penalties)
+-- processnoads(head,respace,"respace")
+-- return true
+-- end
-- The following code is dedicated to Luigi Scarso who pointed me
-- to the fact that \not= is not producing valid pdf-a code.
diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf
index 7ff0b264d..f3905fec8 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 0eba8309b..2836e86bc 100644
--- a/tex/context/base/status-lua.pdf
+++ b/tex/context/base/status-lua.pdf
Binary files differ
diff --git a/tex/context/base/task-ini.lua b/tex/context/base/task-ini.lua
index 3cc5ae9fa..a4f56c2d0 100644
--- a/tex/context/base/task-ini.lua
+++ b/tex/context/base/task-ini.lua
@@ -78,7 +78,7 @@ appendaction("math", "normalizers", "noads.handlers.relocate", nil, "noh
appendaction("math", "normalizers", "noads.handlers.render", nil, "nohead") -- always on
appendaction("math", "normalizers", "noads.handlers.collapse", nil, "nohead") -- always on
appendaction("math", "normalizers", "noads.handlers.resize", nil, "nohead") -- always on
-appendaction("math", "normalizers", "noads.handlers.respace", nil, "nohead") -- always on
+------------("math", "normalizers", "noads.handlers.respace", nil, "nohead") -- always on
appendaction("math", "normalizers", "noads.handlers.check", nil, "nohead") -- always on
appendaction("math", "normalizers", "noads.handlers.tags", nil, "nohead") -- disabled
appendaction("math", "normalizers", "noads.handlers.italics", nil, "nohead") -- disabled
diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua
index 6ee50cb6f..cfafbbe9c 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 : 11/30/12 22:53:44
+-- merge date : 12/01/12 13:03:10
do -- begin closure to overcome local limits and interference