diff options
author | Hans Hagen <pragma@wxs.nl> | 2013-07-24 13:41:00 +0200 |
---|---|---|
committer | Hans Hagen <pragma@wxs.nl> | 2013-07-24 13:41:00 +0200 |
commit | c0b1b842fe3d57ce96623350330f217e3773f5f2 (patch) | |
tree | e91e81fad3a3a9b83f9b1fe4059becb27aeb584e /tex | |
parent | 62fa0c3dd6639f3a8c8c5a0bb1afdf22e033bee8 (diff) | |
download | context-c0b1b842fe3d57ce96623350330f217e3773f5f2.tar.gz |
beta 2013.07.24 13:41
Diffstat (limited to 'tex')
-rw-r--r-- | tex/context/base/cont-new.mkiv | 2 | ||||
-rw-r--r-- | tex/context/base/context-version.pdf | bin | 4109 -> 4105 bytes | |||
-rw-r--r-- | tex/context/base/context.mkiv | 2 | ||||
-rw-r--r-- | tex/context/base/math-ini.lua | 44 | ||||
-rw-r--r-- | tex/context/base/math-stc.mkvi | 16 | ||||
-rw-r--r-- | tex/context/base/status-files.pdf | bin | 24652 -> 24649 bytes | |||
-rw-r--r-- | tex/context/base/status-lua.log | 2 | ||||
-rw-r--r-- | tex/context/base/x-mathml.mkiv | 106 | ||||
-rw-r--r-- | tex/generic/context/luatex/luatex-fonts-merged.lua | 2 |
9 files changed, 108 insertions, 66 deletions
diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv index 9968828a6..096bd68e2 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{2013.07.23 09:41} +\newcontextversion{2013.07.24 13:41} %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 Binary files differindex ff115de20..845c06402 100644 --- a/tex/context/base/context-version.pdf +++ b/tex/context/base/context-version.pdf diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv index aba14e2f7..9574dcc6a 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{2013.07.23 09:41} +\edef\contextversion{2013.07.24 13:41} \edef\contextkind {beta} %D For those who want to use this: diff --git a/tex/context/base/math-ini.lua b/tex/context/base/math-ini.lua index a969ab414..c6d96dab2 100644 --- a/tex/context/base/math-ini.lua +++ b/tex/context/base/math-ini.lua @@ -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 formatters, find = string.formatters, string.find -local utfchar, utfbyte = utf.char, utf.byte +local utfchar, utfbyte, utflength = utf.char, utf.byte, utf.length local floor = math.floor local context = context @@ -316,16 +316,35 @@ function mathematics.define(family) end -- needed for mathml analysis - +-- string with # > 1 are invalid -- we could cache +local lpegmatch = lpeg.match + +local utf8byte = lpeg.patterns.utf8byte * lpeg.P(-1) + +-- function somechar(c) +-- local b = lpegmatch(utf8byte,c) +-- return b and chardata[b] +-- end + + +local somechar = { } + +table.setmetatableindex(somechar,function(t,k) + local b = lpegmatch(utf8byte,k) + local v = b and chardata[b] or false + t[k] = v + return v +end) + local function utfmathclass(chr, default) - local cd = chardata[utfbyte(chr)] + local cd = somechar[chr] return cd and cd.mathclass or default or "unknown" end local function utfmathaccent(chr,default,asked1,asked2) - local cd = chardata[utfbyte(chr)] + local cd = somechar[chr] if not cd then return default or false end @@ -369,13 +388,13 @@ local function utfmathaccent(chr,default,asked1,asked2) return default or false end -local function utfmathstretch(chr, default) -- "h", "v", "b", "" - local cd = chardata[utfbyte(chr)] +local function utfmathstretch(chr,default) -- "h", "v", "b", "" + local cd = somechar[chr] return cd and cd.mathstretch or default or "" end local function utfmathcommand(chr,default,asked1,asked2) - local cd = chardata[utfbyte(chr)] + local cd = somechar[chr] if not cd then return default or "" end @@ -424,7 +443,7 @@ local function utfmathcommand(chr,default,asked1,asked2) end local function utfmathfiller(chr, default) - local cd = chardata[utfbyte(chr)] + local cd = somechar[chr] local cmd = cd and (cd.mathfiller or cd.mathname) return cmd or default or "" end @@ -448,13 +467,8 @@ end function commands.utfmathcommandabove(asked) context(utfmathcommand(asked,nil,"topaccent","over" )) end function commands.utfmathcommandbelow(asked) context(utfmathcommand(asked,nil,"botaccent","under")) end -function commands.doifelseutfmathabove(chr) - commands.doifelse(utfmathaccent(chr,nil,"topaccent","over")) -end - -function commands.doifelseutfmathbelow(chr) - commands.doifelse(utfmathaccent(chr,nil,"botaccent","under")) -end +function commands.doifelseutfmathabove(chr) commands.doifelse(utfmathaccent(chr,nil,"topaccent","over" )) end +function commands.doifelseutfmathbelow(chr) commands.doifelse(utfmathaccent(chr,nil,"botaccent","under")) end -- helpers -- diff --git a/tex/context/base/math-stc.mkvi b/tex/context/base/math-stc.mkvi index 943fcd710..9a98d4d5d 100644 --- a/tex/context/base/math-stc.mkvi +++ b/tex/context/base/math-stc.mkvi @@ -123,6 +123,7 @@ [%c!alternative=\v!text, % text | mathematics \c!left=, \c!right=, + \c!mathclass=\s!rel, \c!alternative=\v!normal, \c!mp=math:stacker:\number\scratchunicode, \c!mpheight=\exheight, @@ -255,7 +256,8 @@ {\begingroup \edef\currentmathstackers{#category}% \mathstackersparameter\c!left\relax - \ifmmode\mathrel\else\dontleavehmode\fi + \ifmmode\math_class_by_parameter\mathstackersparameter\else\dontleavehmode\fi +% \ifmmode\mathrel\else\dontleavehmode\fi {\edef\p_offset {\mathstackersparameter\c!offset}% \edef\p_location {\mathstackersparameter\c!location}% \edef\p_order {\mathstackersparameter\c!order}% @@ -322,13 +324,13 @@ \fi % \ifdim\wd\scratchboxone<\scratchwidth - \setbox\scratchboxone\hbox to \scratchwidth{\hss\box\scratchboxone\hss}% + \setbox\scratchboxone\hbox to \scratchwidth{\hss\unhbox\scratchboxone\hss}% unhboxing makes leaders work \fi \ifdim\wd\scratchboxtwo<\scratchwidth - \setbox\scratchboxtwo\hbox to \scratchwidth{\hss\box\scratchboxtwo\hss}% + \setbox\scratchboxtwo\hbox to \scratchwidth{\hss\unhbox\scratchboxtwo\hss}% \fi \ifdim\wd\scratchboxthree<\scratchwidth - \setbox\scratchboxthree\hbox to \scratchwidth{\hss\box\scratchboxthree\hss}% + \setbox\scratchboxthree\hbox to \scratchwidth{\hss\unhbox\scratchboxthree\hss}% \fi % \ifcsname\??mathstackerslocation\p_location\endcsname @@ -484,7 +486,8 @@ \kern-\scratchwidth \ifcase#top\else \math_stackers_top\bgroup - \raise\dimexpr\scratchheight+\scratchtopoffset\relax + % \raise\dimexpr\scratchheight+\scratchtopoffset\relax + \raise\dimexpr\scratchheight+\mathstackersparameter\c!voffset\relax \box\scratchboxtwo \egroup \fi @@ -495,7 +498,8 @@ \fi \ifcase#bottom\else \math_stackers_bottom\bgroup - \lower\dimexpr\scratchdepth+\ht\scratchboxtwo+\scratchbottomoffset\relax + % \lower\dimexpr\scratchdepth+\ht\scratchboxtwo+\scratchbottomoffset\relax + \lower\dimexpr\scratchdepth+\ht\scratchboxtwo+\mathstackersparameter\c!voffset\relax \box\scratchboxtwo \egroup \fi diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf Binary files differindex da2053120..c080184ad 100644 --- a/tex/context/base/status-files.pdf +++ b/tex/context/base/status-files.pdf diff --git a/tex/context/base/status-lua.log b/tex/context/base/status-lua.log index 4270c47c4..fa056bf0b 100644 --- a/tex/context/base/status-lua.log +++ b/tex/context/base/status-lua.log @@ -1,6 +1,6 @@ (cont-yes.mkiv -ConTeXt ver: 2013.07.23 09:41 MKIV beta fmt: 2013.7.23 int: english/english +ConTeXt ver: 2013.07.24 13:41 MKIV beta fmt: 2013.7.24 int: english/english system > 'cont-new.mkiv' loaded (cont-new.mkiv) diff --git a/tex/context/base/x-mathml.mkiv b/tex/context/base/x-mathml.mkiv index 5d70d8d3f..b9a17d076 100644 --- a/tex/context/base/x-mathml.mkiv +++ b/tex/context/base/x-mathml.mkiv @@ -201,6 +201,10 @@ \def\mmlprelast#1{\xmlelement{#1}{-2}} \def\mmllast #1{\xmlelement{#1}{-1}} +\unexpanded\def\mmlunexpandedfirst #1{\xmlelement{#1}{1}} % we can move these inline if needed +\unexpanded\def\mmlunexpandedsecond #1{\xmlelement{#1}{2}} +\unexpanded\def\mmlunexpandedthird #1{\xmlelement{#1}{3}} + \starttexdefinition doifelsemmlfunction #1 \xmldoifelse {#1} {/mml:fn} { \firstoftwoarguments @@ -2185,63 +2189,83 @@ % todo: combine topaccent/over/bottomaccent/under check +\definemathextensible [mathematics] [mml:overleftarrow] ["2190] % ["27F5] +\definemathextensible [mathematics] [mml:overrightarrow] ["2192] % ["27F6] +\definemathextensible [mathematics] [mml:overleftrightarrow] ["27F7] +\definemathextensible [mathematics] [mml:underleftarrow] ["2190] % ["27F5] +\definemathextensible [mathematics] [mml:underrightarrow] ["2192] % ["27F6] +\definemathextensible [mathematics] [mml:underleftrightarrow] ["27F7] + +\definemathtriplet [mathematics] [mmlovertriplet] +\definemathtriplet [mathematics] [mmlundertriplet] +\definemathtriplet [mathematics] [mmldoubletriplet] + +\unexpanded\def\mmloverof#1{\mmlexecuteifdefined\mmlovercommand\relax{\mmlunexpandedfirst {#1}}\relax} +\unexpanded\def\mmloveros#1{\mmlexecuteifdefined\mmlovercommand {\mmlunexpandedsecond{#1}}\relax} +\unexpanded\def\mmloverbf#1{\mmlexecuteifdefined\mmlbasecommand {\mmlunexpandedfirst {#1}}\relax} +\unexpanded\def\mmloverbs#1{\mmlexecuteifdefined\mmlbasecommand\relax{\mmlunexpandedsecond{#1}}\relax} + \startxmlsetups mml:mover - \edef\mmlovertoken{\xmlraw{#1}{/mml:*[2]}} - \doifelseutfmathabove\mmlovertoken {% not ok + \edef\mmlovertoken{\xmlraw{#1}{/mml:*[2]}}% /text() + \doifelseutfmathabove\mmlovertoken { \edef\mmlovercommand{\utfmathcommandabove\mmlovertoken} - \mmlexecuteifdefined\mmlovercommand\mathematics{\mmlfirst{#1}} + \mmloverof{#1} } { - \edef\mmlbasetoken{\xmlraw{#1}{/mml:*[1]}} - \edef\mmlbasecommand{\utfmathfiller\mmlbasetoken} - \edef\mmlovercommand{\utfmathfiller\mmlovertoken} - \vbox { - \mathsurround\zeropoint - \ialign { - \hss$\alignmark\alignmark$\hss - \crcr - \noalign{\kern3\onepoint}% - \mmlexecuteifdefined\mmlovercommand{\mmlsecond{#1}}{}% extra {} is safeguard - \crcr - \noalign{\kern3\onepoint\nointerlineskip}% - \mmlexecuteifdefined\mmlbasecommand{\mmlfirst{#1}}{}% extra {} is safeguard - \crcr - } + \edef\mmlbasetoken{\xmlraw{#1}{/mml:*[1]}}% /text() + \doifelseutfmathabove\mmlbasetoken { + \edef\mmlbasecommand{mml:\utfmathcommandabove\mmlbasetoken} + \mmloverbs{#1} + } { + \edef\mmlbasecommand{\utfmathfiller\mmlbasetoken} + \edef\mmlovercommand{\utfmathfiller\mmlovertoken} + \mmlovertriplet{\mmloveros{#1}}{\mmloverbf{#1}}\relax } } -% \limits % spoils spacing + % \limits % spoils spacing \stopxmlsetups -% messy: <munder><mo>(</mo><mo>_</mo></munder> +\unexpanded\def\mmlunderuf#1{\mmlexecuteifdefined\mmlundercommand\relax {\mmlunexpandedfirst {#1}}\relax} +\unexpanded\def\mmlunderus#1{\mmlexecuteifdefined\mmlundercommand {\mmlunexpandedsecond{#1}}\relax} +\unexpanded\def\mmlunderbf#1{\mmlexecuteifdefined\mmlbasecommand {\mmlunexpandedfirst {#1}}\relax} +\unexpanded\def\mmlunderbs#1{\mmlexecuteifdefined\mmlbasecommand \relax{}{\mmlunexpandedsecond{#1}}\relax} \startxmlsetups mml:munder - \edef\mmlundertoken{\xmlraw{#1}{/mml:*[2]}} - \doifelseutfmathbelow\mmlundertoken { + \edef\mmlundertoken{\xmlraw{#1}{/mml:*[2]}}% /text() + \doifelseutfmathbelow\mmlundertoken {% \edef\mmlundercommand{\utfmathcommandbelow\mmlundertoken} - \mmlexecuteifdefined\mmlundercommand\mathematics{\mmlfirst{#1}} + \mmlunderuf{#1} } { - \edef\mmlbasetoken {\xmlraw{#1}{/mml:*[1]}} - \edef\mmlbasecommand {\utfmathfiller\mmlbasetoken} - \edef\mmlundercommand{\utfmathfiller\mmlundertoken} - \vtop { - \mathsurround\zeropoint \ialign { - \hss$##$\hss - \crcr - \mmlexecuteifdefined\mmlbasecommand {\mmlfirst{#1}} - \crcr - \noalign{\kern3\onepoint\nointerlineskip}% - \mmlexecuteifdefined\mmlundercommand{\mmlsecond{#1}} - \crcr - \noalign{\kern3\onepoint} - } + \edef\mmlbasetoken{\xmlraw{#1}{/mml:*[1]}}% /text() + \doifelseutfmathbelow\mmlbasetoken { + \edef\mmlbasecommand{mml:\utfmathcommandbelow\mmlbasetoken} + \mmlunderbs{#1} + } { + \edef\mmlbasecommand {\utfmathfiller\mmlbasetoken} + \edef\mmlundercommand{\utfmathfiller\mmlundertoken} + \mmlundertriplet{\mmlunderus{#1}}{\mmlunderbf{#1}}\relax } } -% \limits % spoils spacing + % \limits % spoils spacing \stopxmlsetups +\unexpanded\def\mmlunderoverst#1{\mmlexecuteifdefined\mmlbasecommand \relax{\mmlunexpandedsecond{#1}}{\mmlunexpandedthird{#1}}\relax} +\unexpanded\def\mmlunderoverbf#1{\mmlexecuteifdefined\mmlbasecommand {\mmlunexpandedfirst {#1}}\relax} +\unexpanded\def\mmlunderoverus#1{\mmlexecuteifdefined\mmlundercommand {\mmlunexpandedsecond{#1}}\relax} +\unexpanded\def\mmlunderoverot#1{\mmlexecuteifdefined\mmlovercommand {\mmlunexpandedthird {#1}}\relax} + \startxmlsetups mml:munderover - \edef\mmlbasetoken{\xmlraw{#1}{/mml:*[1]}} - \edef\mmlbasecommand{\utfmathcommand\mmlbasetoken} - \mmlexecuteifdefined\mmlbasecommand{\mathematics{\mmlfirst{#1}}}\normalsubscript{\mmlsecond{#1}}\normalsuperscript{\mmlthird{#1}} + \edef\mmlbasetoken{\xmlraw{#1}{/mml:*[1]}}% /text() + \doifelseutfmathbelow\mmlbasetoken { + \edef\mmlbasecommand{mml:\utfmathcommandbelow\mmlbasetoken} + \mmlunderoverst{#1} + } { + \edef\mmlundertoken {\xmlraw{#1}{/mml:*[2]}}% /text() + \edef\mmlovertoken {\xmlraw{#1}{/mml:*[3]}}% /text() + \edef\mmlbasecommand {\utfmathfiller\mmlbasetoken} + \edef\mmlundercommand{\utfmathfiller\mmlundertoken} + \edef\mmlovercommand {\utfmathfiller\mmlovertoken} + \mmldoubletriplet{\mmlunderoverbf{#1}}{\mmlunderoverus{#1}}{\mmlunderoverot{#1}}\relax + } \stopxmlsetups % tables (mml:mtable, mml:mtr, mml:mlabledtr, mml:mtd) diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index a904feeea..51e84d598 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 : 07/23/13 09:41:21 +-- merge date : 07/24/13 13:41:05 do -- begin closure to overcome local limits and interference |