summaryrefslogtreecommitdiff
path: root/tex/context/base
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2022-08-05 12:41:19 +0200
committerContext Git Mirror Bot <phg@phi-gamma.net>2022-08-05 12:41:19 +0200
commit79db9f0bfc67ea8b4ed21d966e270f0adddfd8b8 (patch)
tree47d1b3ffd491caa9bd24117387d7eb7ba5535637 /tex/context/base
parent1e83b1b27a30fc8df44607a37103b6c65efec538 (diff)
downloadcontext-79db9f0bfc67ea8b4ed21d966e270f0adddfd8b8.tar.gz
2022-08-05 11:41:00
Diffstat (limited to 'tex/context/base')
-rw-r--r--tex/context/base/mkii/cont-new.mkii2
-rw-r--r--tex/context/base/mkii/context.mkii2
-rw-r--r--tex/context/base/mkii/mult-fr.mkii8
-rw-r--r--tex/context/base/mkiv/cont-new.mkiv2
-rw-r--r--tex/context/base/mkiv/context.mkiv2
-rw-r--r--tex/context/base/mkiv/lxml-tex.lua2
-rw-r--r--tex/context/base/mkiv/mult-low.lua1
-rw-r--r--tex/context/base/mkiv/mult-prm.lua9
-rw-r--r--tex/context/base/mkiv/scrp-cjk.lua1
-rw-r--r--tex/context/base/mkiv/status-files.pdfbin24614 -> 24626 bytes
-rw-r--r--tex/context/base/mkiv/status-lua.pdfbin258885 -> 259607 bytes
-rw-r--r--tex/context/base/mkxl/attr-ini.lmt10
-rw-r--r--tex/context/base/mkxl/cont-new.mkxl2
-rw-r--r--tex/context/base/mkxl/context.mkxl2
-rw-r--r--tex/context/base/mkxl/lpdf-lmt.lmt2
-rw-r--r--tex/context/base/mkxl/math-ali.lmt17
-rw-r--r--tex/context/base/mkxl/math-ali.mkxl37
-rw-r--r--tex/context/base/mkxl/math-dif.mkxl9
-rw-r--r--tex/context/base/mkxl/math-fen.mkxl23
-rw-r--r--tex/context/base/mkxl/math-ini.lmt141
-rw-r--r--tex/context/base/mkxl/math-ini.mkxl69
-rw-r--r--tex/context/base/mkxl/math-spa.lmt36
-rw-r--r--tex/context/base/mkxl/math-twk.mkxl22
-rw-r--r--tex/context/base/mkxl/node-nut.lmt6
-rw-r--r--tex/context/base/mkxl/strc-mat.mkxl9
25 files changed, 377 insertions, 37 deletions
diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii
index ab5bc863f..e5eeff7b9 100644
--- a/tex/context/base/mkii/cont-new.mkii
+++ b/tex/context/base/mkii/cont-new.mkii
@@ -11,7 +11,7 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-\newcontextversion{2022.08.01 20:30}
+\newcontextversion{2022.08.05 11:40}
%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/mkii/context.mkii b/tex/context/base/mkii/context.mkii
index b7cadf7a8..e302eb6f9 100644
--- a/tex/context/base/mkii/context.mkii
+++ b/tex/context/base/mkii/context.mkii
@@ -20,7 +20,7 @@
%D your styles an modules.
\edef\contextformat {\jobname}
-\edef\contextversion{2022.08.01 20:30}
+\edef\contextversion{2022.08.05 11:40}
%D For those who want to use this:
diff --git a/tex/context/base/mkii/mult-fr.mkii b/tex/context/base/mkii/mult-fr.mkii
index 1c9591d67..0d2c7c424 100644
--- a/tex/context/base/mkii/mult-fr.mkii
+++ b/tex/context/base/mkii/mult-fr.mkii
@@ -870,6 +870,7 @@
\setinterfaceconstant{frameradius}{rayoncadre}
\setinterfaceconstant{frames}{cadres}
\setinterfaceconstant{freeregion}{regionlibre}
+\setinterfaceconstant{freezespacing}{freezespacing}
\setinterfaceconstant{from}{de}
\setinterfaceconstant{functioncolor}{couleurfonction}
\setinterfaceconstant{functionstyle}{stylefonction}
@@ -950,6 +951,7 @@
\setinterfaceconstant{lastpubsep}{sepdernierepub}
\setinterfaceconstant{layout}{miseenpage}
\setinterfaceconstant{left}{gauche}
+\setinterfaceconstant{leftclass}{leftclass}
\setinterfaceconstant{leftcolor}{couleurgauche}
\setinterfaceconstant{leftcompoundhyphen}{traitdunioncomposegauche}
\setinterfaceconstant{leftedge}{bordgauche}
@@ -1008,6 +1010,7 @@
\setinterfaceconstant{menu}{menu}
\setinterfaceconstant{method}{methode}
\setinterfaceconstant{middle}{milieu}
+\setinterfaceconstant{middleclass}{middleclass}
\setinterfaceconstant{middlecolor}{couleurmilieu}
\setinterfaceconstant{middlecommand}{commandemilieu}
\setinterfaceconstant{middlesource}{middlesource}
@@ -1054,6 +1057,8 @@
\setinterfaceconstant{numberconversionset}{jeuconversionnumero}
\setinterfaceconstant{numberdistance}{distancenumero}
\setinterfaceconstant{numbering}{numérotation}
+\setinterfaceconstant{numberlocation}{numberlocation}
+\setinterfaceconstant{numbermethod}{numbermethod}
\setinterfaceconstant{numberorder}{ordrenumero}
\setinterfaceconstant{numberprefix}{prefixenumero}
\setinterfaceconstant{numbersegments}{segmentsnumero}
@@ -1064,6 +1069,7 @@
\setinterfaceconstant{numberstopper}{stoppeurnumero}
\setinterfaceconstant{numberstrut}{entretoisenumero}
\setinterfaceconstant{numberstyle}{stylenumero}
+\setinterfaceconstant{numberthreshold}{numberthreshold}
\setinterfaceconstant{numberwidth}{largeurnumero}
\setinterfaceconstant{nx}{nx}
\setinterfaceconstant{ny}{ny}
@@ -1117,6 +1123,7 @@
\setinterfaceconstant{palet}{palette}
\setinterfaceconstant{paper}{papier}
\setinterfaceconstant{paragraph}{paragraphe}
+\setinterfaceconstant{penalties}{penalties}
\setinterfaceconstant{period}{periode}
\setinterfaceconstant{place}{placer}
\setinterfaceconstant{placehead}{placertete}
@@ -1170,6 +1177,7 @@
\setinterfaceconstant{reverse}{inverser}
\setinterfaceconstant{right}{droite}
\setinterfaceconstant{rightchars}{caracteresdroite}
+\setinterfaceconstant{rightclass}{rightclass}
\setinterfaceconstant{rightcolor}{couleurdroite}
\setinterfaceconstant{rightcompoundhyphen}{traitdunioncomposedroite}
\setinterfaceconstant{rightedge}{borddroit}
diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv
index 736563f33..493ef50a7 100644
--- a/tex/context/base/mkiv/cont-new.mkiv
+++ b/tex/context/base/mkiv/cont-new.mkiv
@@ -13,7 +13,7 @@
% \normalend % uncomment this to get the real base runtime
-\newcontextversion{2022.08.01 20:30}
+\newcontextversion{2022.08.05 11:40}
%D This file is loaded at runtime, thereby providing an excellent place for hacks,
%D patches, extensions and new features. There can be local overloads in cont-loc
diff --git a/tex/context/base/mkiv/context.mkiv b/tex/context/base/mkiv/context.mkiv
index 70ef42f89..736cd6e73 100644
--- a/tex/context/base/mkiv/context.mkiv
+++ b/tex/context/base/mkiv/context.mkiv
@@ -49,7 +49,7 @@
%D {YYYY.MM.DD HH:MM} format.
\edef\contextformat {\jobname}
-\edef\contextversion{2022.08.01 20:30}
+\edef\contextversion{2022.08.05 11:40}
%D Kind of special:
diff --git a/tex/context/base/mkiv/lxml-tex.lua b/tex/context/base/mkiv/lxml-tex.lua
index 95fafafac..520797883 100644
--- a/tex/context/base/mkiv/lxml-tex.lua
+++ b/tex/context/base/mkiv/lxml-tex.lua
@@ -2251,7 +2251,7 @@ function lxml.snippet(id,i)
if e then
local dt = e.dt
if dt then
- local dti = dt[i]
+ local dti = dt[tonumber(i)] -- string in lxml
if dti then
xmlsprint(dti,e)
end
diff --git a/tex/context/base/mkiv/mult-low.lua b/tex/context/base/mkiv/mult-low.lua
index b20156062..d2097e7b6 100644
--- a/tex/context/base/mkiv/mult-low.lua
+++ b/tex/context/base/mkiv/mult-low.lua
@@ -215,6 +215,7 @@ return {
"checkligatureclassoptioncode", "checkitaliccorrectionclassoptioncode", "checkkernpairclassoptioncode",
"flattenclassoptioncode", "omitpenaltyclassoptioncode", "unpackclassoptioncode", "raiseprimeclassoptioncode",
"carryoverlefttopkernclassoptioncode", "carryoverleftbottomkernclassoptioncode", "carryoverrighttopkernclassoptioncode", "carryoverrightbottomkernclassoptioncode",
+ "preferdelimiterdimensionsclassoptioncode",
--
"noligaturingglyphoptioncode", "nokerningglyphoptioncode", "noleftligatureglyphoptioncode",
"noleftkernglyphoptioncode", "norightligatureglyphoptioncode", "norightkernglyphoptioncode",
diff --git a/tex/context/base/mkiv/mult-prm.lua b/tex/context/base/mkiv/mult-prm.lua
index e935fb40c..ceaa8d5e7 100644
--- a/tex/context/base/mkiv/mult-prm.lua
+++ b/tex/context/base/mkiv/mult-prm.lua
@@ -106,6 +106,8 @@ return {
"Umathdelimitershortfall",
"Umathdelimiterundervariant",
"Umathdenominatorvariant",
+ "Umathdict",
+ "Umathdictdef",
"Umathextrasubpreshift",
"Umathextrasubprespace",
"Umathextrasubshift",
@@ -227,8 +229,10 @@ return {
"Ustack",
"Ustartdisplaymath",
"Ustartmath",
+ "Ustartmathmode",
"Ustopdisplaymath",
"Ustopmath",
+ "Ustopmathmode",
"Ustyle",
"Usubprescript",
"Usubscript",
@@ -479,6 +483,8 @@ return {
"mathbackwardpenalties",
"mathbeginclass",
"mathcheckfencesmode",
+ "mathdictgroup",
+ "mathdictproperties",
"mathdirection",
"mathdisplaymode",
"mathdisplayskipmode",
@@ -492,6 +498,7 @@ return {
"mathghost",
"mathgluemode",
"mathgroupingmode",
+ "mathinlinemainstyle",
"mathleftclass",
"mathlimitsmode",
"mathmiddle",
@@ -574,6 +581,8 @@ return {
"setdefaultmathcodes",
"setfontid",
"setmathatomrule",
+ "setmathdisplaypostpenalty",
+ "setmathdisplayprepenalty",
"setmathignore",
"setmathoptions",
"setmathpostpenalty",
diff --git a/tex/context/base/mkiv/scrp-cjk.lua b/tex/context/base/mkiv/scrp-cjk.lua
index f9df7ed45..0667e8031 100644
--- a/tex/context/base/mkiv/scrp-cjk.lua
+++ b/tex/context/base/mkiv/scrp-cjk.lua
@@ -695,6 +695,7 @@ local chinese_8 = {
hiragana = stretch_break, -- nobreak_autoshrink_break_stretch,
katakana = stretch_break, -- nobreak_autoshrink_break_stretch,
half_width_open = nobreak_autoshrink_break_stretch_nobreak_autoshrink,
+half_width_open = stretch_break,
half_width_close = nobreak_autoshrink_nobreak_stretch,
full_width_open = nobreak_autoshrink_break_stretch_nobreak_shrink,
full_width_close = nobreak_autoshrink_nobreak_stretch,
diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf
index b900f2fb5..a41240d11 100644
--- a/tex/context/base/mkiv/status-files.pdf
+++ b/tex/context/base/mkiv/status-files.pdf
Binary files differ
diff --git a/tex/context/base/mkiv/status-lua.pdf b/tex/context/base/mkiv/status-lua.pdf
index 776c1f125..aafa04ff5 100644
--- a/tex/context/base/mkiv/status-lua.pdf
+++ b/tex/context/base/mkiv/status-lua.pdf
Binary files differ
diff --git a/tex/context/base/mkxl/attr-ini.lmt b/tex/context/base/mkxl/attr-ini.lmt
index 059de8fd7..8b2ec8911 100644
--- a/tex/context/base/mkxl/attr-ini.lmt
+++ b/tex/context/base/mkxl/attr-ini.lmt
@@ -216,12 +216,14 @@ function attributes.registervalue(index,value)
-- this can be an option
for i=c[1],c[2] do
if list[i] == nil then
+ -- we avoid 0 because that can be a signal attribute value
+ local n = i == 0 and 1 or i
if trace_values then
- report_value("reusing slot %i for attribute %i in range (%i,%i)",i,index,c[1],c[2])
+ report_value("reusing slot %i for attribute %i in range (%i,%i)",n,index,c[1],c[2])
end
- c[1] = i
- list[i] = value
- return i
+ c[1] = n
+ list[n] = value
+ return n
end
end
else
diff --git a/tex/context/base/mkxl/cont-new.mkxl b/tex/context/base/mkxl/cont-new.mkxl
index f72bb5f81..f9cc4b1b1 100644
--- a/tex/context/base/mkxl/cont-new.mkxl
+++ b/tex/context/base/mkxl/cont-new.mkxl
@@ -13,7 +13,7 @@
% \normalend % uncomment this to get the real base runtime
-\newcontextversion{2022.08.01 20:30}
+\newcontextversion{2022.08.05 11:40}
%D This file is loaded at runtime, thereby providing an excellent place for hacks,
%D patches, extensions and new features. There can be local overloads in cont-loc
diff --git a/tex/context/base/mkxl/context.mkxl b/tex/context/base/mkxl/context.mkxl
index 27bbaa46a..f167c0f58 100644
--- a/tex/context/base/mkxl/context.mkxl
+++ b/tex/context/base/mkxl/context.mkxl
@@ -29,7 +29,7 @@
%D {YYYY.MM.DD HH:MM} format.
\immutable\edef\contextformat {\jobname}
-\immutable\edef\contextversion{2022.08.01 20:30}
+\immutable\edef\contextversion{2022.08.05 11:40}
%overloadmode 1 % check frozen / warning
%overloadmode 2 % check frozen / error
diff --git a/tex/context/base/mkxl/lpdf-lmt.lmt b/tex/context/base/mkxl/lpdf-lmt.lmt
index cef18529c..7dbbe0cb7 100644
--- a/tex/context/base/mkxl/lpdf-lmt.lmt
+++ b/tex/context/base/mkxl/lpdf-lmt.lmt
@@ -1965,7 +1965,7 @@ do
permissions = permissions | 0xF0C3 -- needs work
--
optionlist = { }
- for k, v in table.sortedhash(options) do
+ for k, v in sortedhash(options) do
if permissions & v == v then
optionlist[#optionlist+1] = k
end
diff --git a/tex/context/base/mkxl/math-ali.lmt b/tex/context/base/mkxl/math-ali.lmt
index a84d5a4c4..718975a50 100644
--- a/tex/context/base/mkxl/math-ali.lmt
+++ b/tex/context/base/mkxl/math-ali.lmt
@@ -82,3 +82,20 @@ function mathematics.registersimplematrix(name,action)
useractions[name] = action
end
end
+
+-- \cases{1, x>0 ; -1, x<0 }
+
+interfaces.implement {
+ name = "simplecases",
+ arguments = "2 strings",
+ actions = function(method,data)
+ -- no methods yet
+ local m = lpegmatch(rows,(gsub(data,"%s+"," ")))
+ for i=1,#m do
+ m[i] = lpegmatch(cols,m[i])
+ end
+ for i=1,#m do
+ context("\\NC %{ \\NC }t \\NR",m[i])
+ end
+ end
+}
diff --git a/tex/context/base/mkxl/math-ali.mkxl b/tex/context/base/mkxl/math-ali.mkxl
index a9e9af722..aaf76c9b1 100644
--- a/tex/context/base/mkxl/math-ali.mkxl
+++ b/tex/context/base/mkxl/math-ali.mkxl
@@ -885,6 +885,39 @@
\frozen\instance \defcsname \e!stop \currentmathcases\endcsname{\math_cases_stop}%
\to \everydefinemathcases
+%D Why not \unknown:
+%D
+%D \starttyping
+%D \definemathcases[mycases][simplecommand=mycases]
+%D
+%D \startformula
+%D \startmycases
+%D \NC 1 \NC x>0 \NR
+%D \NC -1 \NC x<0 \NR
+%D \stopmycases
+%D \stopformula
+%D
+%D \startformula
+%D \mycases{1,x>0;-1,x<0}
+%D \stopformula
+%D \stoptyping
+
+\permanent\tolerant\protected\def\math_cases_simple[#1]#*[#2]#:#3%
+ {\begingroup
+ \edef\currentmathcases{#1}%
+ \setupcurrentmathcases[#2]%
+ \math_cases_start[\currentmathcases]%
+ \clf_simplecases{\mathcasesparameter\c!action}{#3}%
+ \math_cases_stop
+ \endgroup}
+
+\appendtoks
+ \edef\p_simplecommand{\mathcasesparameter\c!simplecommand}%
+ \ifempty\p_simplecommand\else
+ \frozen\protected\instance\edefcsname\p_simplecommand\endcsname{\math_cases_simple[\currentmathcases]}%
+ \fi
+\to \everydefinemathcases
+
\let\math_cases_strut\relax
\newcount\c_math_cases_nc
@@ -2604,6 +2637,9 @@
\permanent\protected\def\math_simplealign_NC
{\aligntab}
+\permanent\protected\def\math_simplealign_EQ
+ {\aligntab=\aligntab}
+
\noaligned\tolerant\permanent\protected\def\math_simplealign_NR[#1]#*[#2]%
{\unskip
\strc_formulas_place_number_nested{#1}{#2}\crcr}
@@ -2630,6 +2666,7 @@
\enforced\let\MC\math_simplealign_NC
\enforced\let\NC\math_simplealign_NC
\enforced\let\NR\math_simplealign_NR
+ \enforced\let\EQ\math_simplealign_EQ
\enforced\let\TB\math_common_TB
\math_eqalign_set_defaults
\math_eqalign_set_columns{\mathsimplealignparameter\c!align}%
diff --git a/tex/context/base/mkxl/math-dif.mkxl b/tex/context/base/mkxl/math-dif.mkxl
index 5cd65a80f..ad53ee25a 100644
--- a/tex/context/base/mkxl/math-dif.mkxl
+++ b/tex/context/base/mkxl/math-dif.mkxl
@@ -20,10 +20,12 @@
% For new times sake:
\let\normal_math_dd\dd
+ \let\normal_math_DD\DD
\def\c!differentiald{differentiald} % for now
\def\upright_math_dd{\mathatom \s!unpack \mathdifferentialcode{\mathupright d}}
+ \def\upright_math_DD{\mathatom \s!unpack \mathdifferentialcode{\mathupright D}}
\permanent\protected\def\dd
{\ifcstok{\mathematicsparameter\c!differentiald}\s!upright
@@ -32,6 +34,13 @@
\normal_math_dd
\fi}
+ \permanent\protected\def\DD
+ {\ifcstok{\mathematicsparameter\c!differentiald}\s!upright
+ \upright_math_DD
+ \else
+ \normal_math_DD
+ \fi}
+
% \setupmathematics[differentiald=upright]
\popoverloadmode
diff --git a/tex/context/base/mkxl/math-fen.mkxl b/tex/context/base/mkxl/math-fen.mkxl
index 85a28acca..8f2a4d405 100644
--- a/tex/context/base/mkxl/math-fen.mkxl
+++ b/tex/context/base/mkxl/math-fen.mkxl
@@ -130,10 +130,12 @@
\s!axis
\s!exact}
-\newconstant \c_math_fenced_class
+\newconstant\c_math_fenced_class
+\integerdef \c_math_fence_check \zerocount
\def\math_fenced_common#1#2#3#4% \Uwhatever class symbol source
{\c_math_fenced_class\mathfenceparameter#2\relax
+ \math_fenced_check_size_mismatch % we need to catch an unbalanced \F as we are sequential
\ifconditional\c_math_fenced_sized
\orelse\ifconditional\c_math_fenced_level_mode
\ifnum\c_math_fenced_class=\mathopencode
@@ -347,14 +349,14 @@
{\math_fenced_fenced_stop\currentmathfence
\endgroup}
-\def\math_fenced_start_wrap#1%
+\protected\def\math_fenced_start_wrap#1%
{\begingroup
\edef\m_math_fenced_wrap{#1}%
\ifempty\m_math_fenced_wrap \else
\math_fenced_fenced_start\m_math_fenced_wrap
\fi}
-\def\math_fenced_stop_wrap
+\protected\def\math_fenced_stop_wrap
{\ifempty\m_math_fenced_wrap \else
\math_fenced_fenced_stop\m_math_fenced_wrap
\fi
@@ -410,6 +412,7 @@
%D \starttyping
%D \startTEXpage[offset=1dk,width=20dk]
%D \ruledhbox{$ \F3 \left( 1 + \F2 \left( a + b \right) + \left( a + b \right) \right) $}\par
+%D \ruledhbox{$ \left( 1 + \F3 \left( a + b \right) + \left( a + b \right) \right) $}\par
%D \ruledhbox{$ \F3 \left( 1 + \F0 \left( a + b \right) \right) $}\par
%D \ruledhbox{$ \F3 \left( 1 + \F= \left( a + b \right) \right) $}\par
%D \ruledhbox{$ \F4 \left( 1 + \fenced[parenthesis]{a + b} \right) $}\par
@@ -435,8 +438,18 @@
\letcsname\??fencelevels*\endcsname\donothing
+\def\math_fenced_check_size_mismatch
+ {\ifnum\c_math_fence_check=\c_math_fence_nesting
+ \c_attr_mathsize\attributeunsetvalue
+ \setfalse\c_math_fenced_level_mode
+ \c_math_fenced_level\zerocount
+ \fi}
+
\permanent\protected\def\F#1%
- {\settrue\c_math_fenced_level_mode
+ {\ifconditional\c_math_fenced_level_mode\else
+ \integerdef\c_math_fence_check\c_math_fence_nesting
+ \fi
+ \settrue\c_math_fenced_level_mode
\ifchknum#1\or
\c_math_fenced_level#1\relax
\orelse\ifcsname\??fencelevels#1\endcsname
@@ -857,7 +870,7 @@
\protected\def\math_fences_auto_left #1{\c_attr_mathautofence\plusone #1\c_attr_mathautofence\attributeunsetvalue}
\protected\def\math_fences_auto_right #1{\c_attr_mathautofence\plustwo #1\c_attr_mathautofence\attributeunsetvalue}
-\protected\def\math_fences_auto_middle#1{\c_attr_mathautofence\plusthree#1\c_attr_mathautofence\attributeunsetvalue nooverflow }
+\protected\def\math_fences_auto_middle#1{\c_attr_mathautofence\plusthree#1\c_attr_mathautofence\attributeunsetvalue}
\protected\def\math_fences_auto_both #1{\c_attr_mathautofence\plusfour #1\c_attr_mathautofence\attributeunsetvalue}
\permanent\let\autofenceopen \math_fences_auto_left % for testing
diff --git a/tex/context/base/mkxl/math-ini.lmt b/tex/context/base/mkxl/math-ini.lmt
index 654e29d2b..48d905ca6 100644
--- a/tex/context/base/mkxl/math-ini.lmt
+++ b/tex/context/base/mkxl/math-ini.lmt
@@ -16,7 +16,7 @@ if not modules then modules = { } end modules ['math-ini'] = {
-- then we also have to set the other characters (only a subset done now)
local next, type = next, type
-local formatters, find = string.formatters, string.find
+local formatters, find, nospaces = string.formatters, string.find, string.nospaces
local utfchar, utfbyte, utflength = utf.char, utf.byte, utf.length
----- floor = math.floor
local sortedhash = table.sortedhash
@@ -48,6 +48,145 @@ local chardata = characters.data
local texsetattribute = tex.setattribute
local setmathcode = tex.setmathcode
local setdelcode = tex.setdelcode
+local texintegerdef = tex.integerdef
+
+-- This is relatively new and experimental:
+
+do
+
+ local dictionaries = { }
+ mathematics.dictionaries = dictionaries
+
+ local names = dictionaries.names or utilities.storage.allocate()
+ local groups = dictionaries.groups or utilities.storage.allocate()
+ local data = dictionaries.data or utilities.storage.allocate()
+
+ if storage then
+ storage.register("mathematics/dictionaries/names", names, "characters.dictionaries.names")
+ storage.register("mathematics/dictionaries/groups", groups, "characters.dictionaries.groups")
+ storage.register("mathematics/dictionaries/data", data, "characters.dictionaries.data")
+ end
+
+ function dictionaries.registergroup(name)
+ local group = rawget(names,name)
+ if not group then
+ group = #groups + 1
+ names[name] = group
+ names[group] = group
+ groups[group] = name
+ data[group] = { }
+ local csname = "math" .. nospaces(name) .. "dictionary"
+ texintegerdef(csname,group,"immutable")
+ end
+ return group
+ end
+
+ function dictionaries.registercharacter(group,index,description)
+ local d = names[group] -- can be number or string
+ if d then
+ data[d][index] = description
+ end
+ end
+
+ local fontchardata = fonts.hashes.characters
+ local f_dictionary = false
+ local register = callback.register
+ local whatdetail = "all"
+
+ local function trace(n,properties,group,index,font,char)
+ -- local properties, group, index, font, char = nodes.nuts.getchardict(nodes.nuts.tonut(n))
+ local char = fontchardata[font][char]
+ if char or whatdetail == "all" then
+ local unicode = char and char.unicode
+ if unicode then
+ local groupname = groups[group]
+ local indexname = false
+ if groupname then
+ indexname = data[group][index] -- dictionaries.data
+ else
+ groupname = "unknown"
+ end
+ if not indexname then
+ indexname = chardata[unicode]
+ indexname = indexname and indexname.description or "unknown"
+ end
+ if not f_dictionary then
+ f_dictionary = formatters["properties [%04X:%04X:%04X] [%s] %U : %s"]
+ end
+ return f_dictionary(properties,group,index,groupname,unicode,indexname)
+ end
+ end
+ end
+
+ trackers.register("math.dictionaries",function(v)
+ whatdetail = v
+ if whatdetail then
+ register("get_math_dictionary",trace)
+ else
+ register("get_math_dictionary")
+ end
+ end)
+
+ register("get_math_dictionary",trace)
+
+ -- This is experimental and a prelude to the long pending "relate math rendering to
+ -- some field" wish. In TeX characters and symbols are grouped by class but that is
+ -- mostly related to spacing etc. while we actually want to group by meaning. A
+ -- reasonable but incomplete starting point is:
+ --
+ -- https://www.w3.org/TR/MathML3/appendixa.html#parsing_DefEncAtt
+ --
+ -- But it has some weird short names mixed with long ones (and a strange suddenly
+ -- uppercase: Differential-Operator) but we are not bound to that at all. We will
+ -- probably remove and add categories anyway. This openmath stuff looks a bit
+ -- abandoned but we can use it as a start and playground anyway.
+ --
+ -- The char-def.lua file will have mathgroup entries reflecting this.
+
+ local registergroup = mathematics.dictionaries.registergroup
+
+ registergroup("default")
+ registergroup("binary arithmic")
+ registergroup("binary linear algebra")
+ registergroup("binary logical")
+ registergroup("binary relation")
+ registergroup("binary set")
+ registergroup("constant arithmic")
+ registergroup("constant set")
+ registergroup("differential")
+ registergroup("integral")
+ registergroup("interval")
+ registergroup("lambda")
+ registergroup("limit")
+ registergroup("nary arithmic")
+ registergroup("nary constructor")
+ registergroup("nary functional")
+ registergroup("nary linear algebra")
+ registergroup("nary logical")
+ registergroup("nary minmax")
+ registergroup("nary relation")
+ registergroup("nary set list")
+ registergroup("nary set relation")
+ registergroup("nary set")
+ registergroup("nary statistics")
+ registergroup("partial") -- partial differential
+ registergroup("product")
+ registergroup("quantifier")
+ registergroup("unary arithmic")
+ registergroup("unary elementary")
+ registergroup("unary functional")
+ registergroup("unary linear algebra")
+ registergroup("unary logical")
+ registergroup("unary set")
+ registergroup("unary vector")
+
+ -- \Umathdictdef\vdash 1 \mathbinarylogicaldictionary "22A2 \mathrelationcode 0 "22A2
+ --
+ -- \startluacode
+ -- mathematics.dictionaries.registercharacter("binary logical",0x22A2,"implies")
+ -- \stopluacode
+
+end
-- These are different from mkiv with luatex.
diff --git a/tex/context/base/mkxl/math-ini.mkxl b/tex/context/base/mkxl/math-ini.mkxl
index d3d652b37..0ce6d14ef 100644
--- a/tex/context/base/mkxl/math-ini.mkxl
+++ b/tex/context/base/mkxl/math-ini.mkxl
@@ -463,6 +463,11 @@
% +\checkkernpairclassoptioncode
% +\flattenclassoptioncode
% +\omitpenaltyclassoptioncode % old school check, we do pairwise instead
+ % +\carryoverlefttopkernclassoptioncode
+ % +\carryoverleftbottomkernclassoptioncode
+ % +\carryoverrighttopkernclassoptioncode
+ % +\carryoverrightbottomkernclassoptioncode
+ % +\preferdelimiterdimensionsclassoptioncode
\relax
\setmathoptions\mathordinarycode\numexpr
@@ -547,6 +552,7 @@
+\carryoverleftbottomkernclassoptioncode
+\carryoverrighttopkernclassoptioncode
+\carryoverrightbottomkernclassoptioncode
+ +\preferdelimiterdimensionsclassoptioncode
\relax
\setmathoptions\mathradicalcode\numexpr
@@ -556,6 +562,7 @@
+\carryoverleftbottomkernclassoptioncode
+\carryoverrighttopkernclassoptioncode
+\carryoverrightbottomkernclassoptioncode
+ +\preferdelimiterdimensionsclassoptioncode
\relax
\setmathoptions\mathaccentcode\numexpr
@@ -591,6 +598,7 @@
+\carryoverleftbottomkernclassoptioncode
+\carryoverrighttopkernclassoptioncode
+\carryoverrightbottomkernclassoptioncode
+ +\preferdelimiterdimensionsclassoptioncode
\relax
% test case for \lefttopkernclassoptioncode and \leftbottomkernclassoptioncode in cambria close:
@@ -738,15 +746,27 @@
\setfalse\indisplaymath
\fi}
+% \permanent\protected\def\startforceddisplaymath
+% {\startimath
+% \displaystyle
+% \begingroup
+% \settrue\indisplaymath}
+%
+% \permanent\protected\def\stopforceddisplaymath
+% {\endgroup
+% \stopimath}
+
+% \def\startidmath{\Ustartmathmode \displaystyle}
+% \def\stopidmath {\Ustopmathmode}
+
\permanent\protected\def\startforceddisplaymath
- {\startimath
- \displaystyle
- \begingroup
+ {\Ustartmathmode \displaystyle
+ \begingroup % can go
\settrue\indisplaymath}
\permanent\protected\def\stopforceddisplaymath
- {\endgroup
- \stopimath}
+ {\endgroup % can go
+ \Ustopmathmode}
\permanent\protected\def\startpickupmath % for the moment private
{\ifconditional\indisplaymath
@@ -877,12 +897,20 @@
\normalstopimath
\fi}
-%D maybe more setters
+%D We wrap in a construct so that we can do:
+%D
+%D \starttyping
+%D \startformula
+%D \dm{f(x) = \frac{x}{y}} \mtp{,}
+%D \im{g(x) = \frac{x}{y}} \mtp{.}
+%D \stopformula
+%D \stoptyping
\permanent\protected\def\dm#1%
{\relax
\ifmmode
- \beginmathgroup\forcedisplaymath#1\endmathgroup
+ %\beginmathgroup\forcedisplaymath#1\endmathgroup
+ \mathconstruct{\forcedisplaymath#1}%
\else
\startimath\begingroup\forcedisplaymath#1\endgroup\stopimath
\fi}
@@ -890,7 +918,8 @@
\permanent\protected\def\im#1%
{\relax
\ifmmode
- \beginmathgroup\forceinlinemath#1\endmathgroup
+ %\beginmathgroup\forceinlinemath#1\endmathgroup
+ \mathconstruct{\forceinlinemath#1}%
\else
\startimath#1\stopimath
\fi}
@@ -4019,6 +4048,30 @@
\scriptspace.05\Umathquad\textstyle % for Mikael
\to \everymathematics
+%D New:
+
+% \startformula
+% \mathatom class 0 all \mathbincode {a b c d} \breakhere
+% \mathatom class 0 all \mathfractioncode {a b c d} \breakhere
+% \base {FE03} \breakhere
+% \base[16]{FE03} \breakhere
+% \base[8] {7204}
+% \stopformula
+
+\permanent\tolerant\def\mathdigits#1%
+ {\ifmmode
+ \mathatom class \mathdigitcode all \mathdigitcode {#1}%
+ \else
+ #1%
+ \fi}
+
+\permanent\tolerant\protected\def\base[#1]#*#:#2%
+ {\ifmmode
+ \mathdigits{\tf#2}\ifparameter#1\or\subscript{\mathdigits{\tf#1}}\fi
+ \else
+ #2\ifparameter#1\or\low{#1}\fi
+ \fi}
+
\protect \endinput
% % not used (yet)
diff --git a/tex/context/base/mkxl/math-spa.lmt b/tex/context/base/mkxl/math-spa.lmt
index 698692a2c..2bde8dd1d 100644
--- a/tex/context/base/mkxl/math-spa.lmt
+++ b/tex/context/base/mkxl/math-spa.lmt
@@ -12,6 +12,8 @@ local setmetatableindex = table.setmetatableindex
local boundary_code = nodes.nodecodes.boundary
local hlist_code = nodes.nodecodes.hlist
+local kern_code = nodes.nodecodes.kern
+local penalty_code = nodes.nodecodes.penalty
local glue_code = nodes.nodecodes.glue
local line_code = nodes.listcodes.line
local ghost_code = nodes.listcodes.ghost
@@ -39,6 +41,7 @@ local addxoffset = nuts.addxoffset
local nextglue = nuts.traversers.glue
local nextlist = nuts.traversers.list
local nextboundary = nuts.traversers.boundary
+local nextnode = nuts.traversers.node
local texgetdimen = tex.getdimen
local texsetdimen = tex.setdimen
@@ -56,15 +59,32 @@ stages[1] = function(specification,stage)
for s in nextboundary, head do
if getdata(s) == boundary then
-- todo: skip over ghost, maybe penalty, maybe glues all in one loop
- local n = getnext(s)
- while n and getid(n) == hlist_code and getsubtype(n) == ghost_code do
- n = getnext(n)
- end
- -- while n and getid(n) == glue_code do
- if n and getid(n) == glue_code then
- n = getnext(n)
+-- local n = getnext(s)
+-- if n and getid(n) == kern_code then -- also needed
+-- n = getnext(n)
+-- end
+-- while n and getid(n) == hlist_code and getsubtype(n) == ghost_code do
+-- n = getnext(n)
+-- end
+-- -- while n and getid(n) == glue_code do
+-- if n and getid(n) == glue_code then
+-- n = getnext(n)
+-- end
+ for n, id, subtype in nextnode, getnext(s) do
+ s = n
+ if id == kern_code then
+ -- move on (s_2 case)
+ elseif id == glue_code then
+ -- move on
+ elseif id == penalty_code then
+ -- move on (untested)
+ elseif id == hlist_code and subtype == ghost_code then
+ -- move on
+ else
+ break
+ end
end
- distance = distance + getdimensions(head,n)
+ distance = distance + getdimensions(head,s)
break
end
end
diff --git a/tex/context/base/mkxl/math-twk.mkxl b/tex/context/base/mkxl/math-twk.mkxl
index 995f48bcb..269c855c0 100644
--- a/tex/context/base/mkxl/math-twk.mkxl
+++ b/tex/context/base/mkxl/math-twk.mkxl
@@ -71,4 +71,26 @@
\permanent\protected\def\±{\mathortext\mathunaryplusminus\textpm}
\permanent\protected\def\∓{\mathortext\mathunaryminusplus\textmp}
+% \permanent\protected\def\minute{\hbox shift -.8ex{$\char"2032$}}
+% \permanent\protected\def\second{\hbox shift -.8ex{$\char"2033$}}
+%
+% \permanent\protected\def\minute{$\char\privatecharactercode{prime 0x2032 1}$}
+% \permanent\protected\def\second{$\char\privatecharactercode{prime 0x2033 1}$}
+%
+% \permanent\protected\def\minute{$\Umathchar\zerocount\zerocount\privatecharactercode{prime 0x2032 1}$}
+% \permanent\protected\def\second{$\Umathchar\zerocount\zerocount\privatecharactercode{prime 0x2033 1}$}
+%
+% \immutable\Umathchardef\minute\zerocount\zerocount\privatecharactercode{prime 0x2032 1}
+% \immutable\Umathchardef\second\zerocount\zerocount\privatecharactercode{prime 0x2033 1}
+
+\immutable\chardef\textminute"2032
+\immutable\chardef\textsecond"2033
+
+\immutable\Umathchardef\mathminute\zerocount\zerocount\privatecharactercode{prime 0x2032 1}
+\immutable\Umathchardef\mathsecond\zerocount\zerocount\privatecharactercode{prime 0x2033 1}
+
+\permanent\protected\def\minute{\iffontchar\font\textminute\textminute\else\mathminute\fi}
+\permanent\protected\def\second{\iffontchar\font\textsecond\textsecond\else\mathsecond\fi}
+
+
\protect
diff --git a/tex/context/base/mkxl/node-nut.lmt b/tex/context/base/mkxl/node-nut.lmt
index 92e8f0990..fccb539f3 100644
--- a/tex/context/base/mkxl/node-nut.lmt
+++ b/tex/context/base/mkxl/node-nut.lmt
@@ -84,7 +84,7 @@ local nuts = {
getboxglue = direct.getglue,
getchar = direct.getchar,
getcharspec = direct.getcharspec,
- getcomponents = direct.getcomponents,
+ -- getcomponents = direct.getcomponents,
getdata = direct.getdata,
getdepth = direct.getdepth,
getdir = direct.getdir,
@@ -92,6 +92,7 @@ local nuts = {
getdisc = direct.getdisc,
getdiscpart = direct.getdiscpart,
getdiscretionary = direct.getdisc,
+ getchardict = direct.getchardict,
getexpansion = direct.getexpansion,
getfam = direct.getfam,
getfield = direct.getfield,
@@ -196,7 +197,7 @@ local nuts = {
setbox = direct.setbox,
setboxglue = direct.setglue,
setchar = direct.setchar,
- setcomponents = direct.setcomponents,
+ -- setcomponents = direct.setcomponents,
setdata = direct.setdata,
setdepth = direct.setdepth,
setdir = direct.setdir,
@@ -204,6 +205,7 @@ local nuts = {
setdisc = direct.setdisc,
setdiscpart = direct.setdiscpart,
setdiscretionary = direct.setdisc,
+ setchardict = direct.setchardict,
setexpansion = direct.setexpansion,
setfam = direct.setfam,
setfield = direct.setfield,
diff --git a/tex/context/base/mkxl/strc-mat.mkxl b/tex/context/base/mkxl/strc-mat.mkxl
index 2f200056b..ed581db6a 100644
--- a/tex/context/base/mkxl/strc-mat.mkxl
+++ b/tex/context/base/mkxl/strc-mat.mkxl
@@ -1133,7 +1133,9 @@
{\vadjust pre \bgroup
\hbox to \displaywidth \bgroup
\strut
+ \hskip\leftskip
#1\hss
+ \hskip\rightskip
\strut
\egroup
\egroup}
@@ -1142,7 +1144,9 @@
{\vadjust \bgroup
\hbox to \displaywidth \bgroup
\strut
+ \hskip\leftskip
#1\hss
+ \hskip\rightskip
\strut
\egroup
\egroup}
@@ -1254,7 +1258,10 @@
\c_strc_math_split_status \zerocount
\to \everymathematics
-%
+\prependtoks
+ % we need to keep an eye on this
+ \mathgluemode\ifcase\raggedstatus\plusthree\else\zerocount\fi
+\to \everymathematics
\defcsname\??mathtextalign\v!flushleft\endcsname
{\raggedright