diff options
Diffstat (limited to 'tex')
-rw-r--r-- | tex/context/base/cont-new.mkiv | 2 | ||||
-rw-r--r-- | tex/context/base/context-version.pdf | bin | 4183 -> 4182 bytes | |||
-rw-r--r-- | tex/context/base/context.mkiv | 2 | ||||
-rw-r--r-- | tex/context/base/enco-ini.mkiv | 6 | ||||
-rw-r--r-- | tex/context/base/font-pre.mkiv | 2 | ||||
-rw-r--r-- | tex/context/base/lang-txt.lua | 5 | ||||
-rw-r--r-- | tex/context/base/math-def.mkiv | 1 | ||||
-rw-r--r-- | tex/context/base/math-fen.mkiv | 112 | ||||
-rw-r--r-- | tex/context/base/math-ini.mkiv | 10 | ||||
-rw-r--r-- | tex/context/base/mult-def.mkiv | 6 | ||||
-rw-r--r-- | tex/context/base/publ-aut.lua | 10 | ||||
-rw-r--r-- | tex/context/base/publ-imp-aps.mkvi | 24 | ||||
-rw-r--r-- | tex/context/base/publ-ini.lua | 4 | ||||
-rw-r--r-- | tex/context/base/publ-ini.mkiv | 8 | ||||
-rw-r--r-- | tex/context/base/status-files.pdf | bin | 24437 -> 24486 bytes | |||
-rw-r--r-- | tex/context/base/status-lua.pdf | bin | 251109 -> 251112 bytes | |||
-rw-r--r-- | tex/context/base/strc-lst.lua | 4 | ||||
-rw-r--r-- | tex/context/base/strc-lst.mkvi | 4 | ||||
-rw-r--r-- | tex/context/base/x-asciimath.lua | 67 | ||||
-rw-r--r-- | tex/context/base/x-calcmath.lua | 7 | ||||
-rw-r--r-- | tex/generic/context/luatex/luatex-fonts-merged.lua | 2 |
21 files changed, 157 insertions, 119 deletions
diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv index a49185ae5..ec97951b7 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.05.11 21:53} +\newcontextversion{2015.05.12 17:57} %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 739afcb0b..73287d375 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 6f5a366e3..de3e6c701 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.05.11 21:53} +\edef\contextversion{2015.05.12 17:57} \edef\contextkind {beta} %D For those who want to use this: diff --git a/tex/context/base/enco-ini.mkiv b/tex/context/base/enco-ini.mkiv index b2e7efd3e..ef0ebef4e 100644 --- a/tex/context/base/enco-ini.mkiv +++ b/tex/context/base/enco-ini.mkiv @@ -55,6 +55,8 @@ \unexpanded\def\enco_define_accent#1#2#3% no spaces, used low level {\setvalue{\??accents\string#1\string#2\empty}{#3}} +% the following dirty trick is needed to catch \asciimath{\^{1/5}log}: + \def\enco_handle_accent#1#2% expandable because we want them in the tuc file {\csname\??accents \ifcsname\??accents\string#1#2\empty\endcsname @@ -62,10 +64,12 @@ \else\ifcsname\??accents\string#1\string#2\empty\endcsname \string#1\string#2\empty \else - \empty + \endcsname#2\csname\??accents % very dirty trick: ignore accent but keep char \fi\fi \endcsname} +\letvalue{\??accents}\empty + \unexpanded\def\enco_define_command#1#2% {\setuvalue{\string#1}{#2}} diff --git a/tex/context/base/font-pre.mkiv b/tex/context/base/font-pre.mkiv index 6072657e9..157b4585a 100644 --- a/tex/context/base/font-pre.mkiv +++ b/tex/context/base/font-pre.mkiv @@ -569,6 +569,8 @@ \definealternativestyle [\v!sansbold] [\ss\bf] [] \definealternativestyle [\v!serifnormal] [\rm\tf] [] \definealternativestyle [\v!serifbold] [\rm\bf] [] +\definealternativestyle [\v!mononormal] [\tt\tf] [] +\definealternativestyle [\v!monobold] [\tt\bf] [] % % maybe we need interface neutral as well (for use in cld): % diff --git a/tex/context/base/lang-txt.lua b/tex/context/base/lang-txt.lua index 298e05db4..2938550ee 100644 --- a/tex/context/base/lang-txt.lua +++ b/tex/context/base/lang-txt.lua @@ -181,6 +181,11 @@ data.labels={ sk="cotg", }, }, + diff={ + labels={ + en="d", + }, + }, deg={ labels={ cz="deg", diff --git a/tex/context/base/math-def.mkiv b/tex/context/base/math-def.mkiv index 0888081f0..8247ac008 100644 --- a/tex/context/base/math-def.mkiv +++ b/tex/context/base/math-def.mkiv @@ -67,6 +67,7 @@ \definemathcommand [sup] [limop] {\mfunctionlabeltext{sup}} \definemathcommand [tanh] [nolop] {\mfunctionlabeltext{tanh}} \definemathcommand [tan] [nolop] {\mfunctionlabeltext{tan}} +\definemathcommand [diff] {\mfunctionlabeltext{diff}} \let\normalmatharg\arg % todo: maybe automatically diff --git a/tex/context/base/math-fen.mkiv b/tex/context/base/math-fen.mkiv index 0e5073630..b2f64890c 100644 --- a/tex/context/base/math-fen.mkiv +++ b/tex/context/base/math-fen.mkiv @@ -219,6 +219,8 @@ \newconditional\c_math_fenced_done \newconditional\c_math_fenced_unknown \settrue\c_math_fenced_unknown +% maybe use \detokenize ... + \def\math_left {\settrue\c_math_fenced_done \edef\m_math_left{\meaning\nexttoken}% @@ -234,6 +236,21 @@ \edef\m_math_middle{\meaning\nexttoken}% \csname\??mathmiddle\ifcsname\??mathmiddle\m_math_middle\endcsname\m_math_middle\else\s!unknown\fi\endcsname} +\unexpanded\def\lfence#1% + {\settrue\c_math_fenced_done + \edef\m_math_left{\meaning#1}% + \csname\??mathleft\ifcsname\??mathleft\m_math_left\endcsname\m_math_left\else\s!unknown\fi\endcsname} + +\unexpanded\def\rfence#1% + {\settrue\c_math_fenced_done + \edef\m_math_right{\meaning#1}% + \csname\??mathright\ifcsname\??mathright\m_math_right\endcsname\m_math_right\else\s!unknown\fi\endcsname} + +\unexpanded\def\mfence#1% + {\settrue\c_math_fenced_done + \edef\m_math_middle{\meaning#1}% + \csname\??mathmiddle\ifcsname\??mathmiddle\m_math_middle\endcsname\m_math_middle\else\s!unknown\fi\endcsname} + \setvalue{\??mathleft \s!unknown}{\setfalse\c_math_fenced_done\ifconditional\c_math_fenced_unknown\normalleft \nexttoken\fi} \setvalue{\??mathright \s!unknown}{\setfalse\c_math_fenced_done\ifconditional\c_math_fenced_unknown\normalright \nexttoken\fi} \setvalue{\??mathmiddle\s!unknown}{\setfalse\c_math_fenced_done\ifconditional\c_math_fenced_unknown\normalmiddle\nexttoken\fi} @@ -242,58 +259,49 @@ {\expandafter\let\csname\??mathleft \meaning#1\endcsname#2% \expandafter\let\csname\??mathright\meaning#3\endcsname#4} -\expandafter\let\csname\??mathleft \meaning [\endcsname\Lbracket -\expandafter\let\csname\??mathleft \meaning (\endcsname\Lparent -\expandafter\let\csname\??mathleft \meaning <\endcsname\Langle -\expandafter\let\csname\??mathleft \meaning ⟨\endcsname\Langle -\expandafter\let\csname\??mathleft \meaning ⟪\endcsname\Ldoubleangle -\expandafter\let\csname\??mathleft \meaning {\endcsname\Lbrace -\expandafter\let\csname\??mathleft \meaning |\endcsname\Lbar -\expandafter\let\csname\??mathleft \meaning ‖\endcsname\Ldoublebar -\expandafter\let\csname\??mathleft \meaning ⦀\endcsname\Ltriplebar -\expandafter\let\csname\??mathleft \meaning /\endcsname\Lsolidus -\expandafter\let\csname\??mathleft \meaning .\endcsname\Lnothing - -\expandafter\let\csname\??mathright\meaning ]\endcsname\Rbracket -\expandafter\let\csname\??mathright\meaning )\endcsname\Rparent -\expandafter\let\csname\??mathright\meaning >\endcsname\Rangle -\expandafter\let\csname\??mathright\meaning ⟩\endcsname\Rangle -\expandafter\let\csname\??mathright\meaning ⟫\endcsname\Rdoubleangle -\expandafter\let\csname\??mathright\meaning }\endcsname\Rbrace -\expandafter\let\csname\??mathright\meaning |\endcsname\Rbar -\expandafter\let\csname\??mathright\meaning ‖\endcsname\Rdoublebar -\expandafter\let\csname\??mathright\meaning ⦀\endcsname\Rtriplebar -\expandafter\let\csname\??mathright\meaning /\endcsname\Rsolidus -\expandafter\let\csname\??mathright\meaning .\endcsname\Rnothing - -\expandafter\let\csname\??mathright\meaning [\endcsname\Lbracketmirrored -\expandafter\let\csname\??mathright\meaning (\endcsname\Lparentmirrored -\expandafter\let\csname\??mathright\meaning <\endcsname\Langlemirrored -\expandafter\let\csname\??mathright\meaning ⟨\endcsname\Langlemirrored -\expandafter\let\csname\??mathright\meaning ⟪\endcsname\Ldoubleanglemirrored -\expandafter\let\csname\??mathright\meaning {\endcsname\Lbracemirrored -%expandafter\let\csname\??mathright\meaning |\endcsname\Lbarmirrored -%expandafter\let\csname\??mathright\meaning ‖\endcsname\Ldoublebarmirrored -%expandafter\let\csname\??mathright\meaning ⦀\endcsname\Ltriplebarmirrored -\expandafter\let\csname\??mathright\meaning /\endcsname\Lsolidusmirrored -\expandafter\let\csname\??mathright\meaning .\endcsname\Lnothingmirrored - -\expandafter\let\csname\??mathleft \meaning ]\endcsname\Rbracketmirrored -\expandafter\let\csname\??mathleft \meaning )\endcsname\Rparentmirrored -\expandafter\let\csname\??mathleft \meaning >\endcsname\Ranglemirrored -\expandafter\let\csname\??mathleft \meaning ⟩\endcsname\Ranglemirrored -\expandafter\let\csname\??mathleft \meaning ⟫\endcsname\Rdoubleanglemirrored -\expandafter\let\csname\??mathleft \meaning }\endcsname\Rbracemirrored -%expandafter\let\csname\??mathleft \meaning |\endcsname\Rbarmirrored -%expandafter\let\csname\??mathleft \meaning ‖\endcsname\Rdoublebarmirrored -%expandafter\let\csname\??mathleft \meaning ⦀\endcsname\Rtriplebarmirrored -\expandafter\let\csname\??mathleft \meaning /\endcsname\Rsolidusmirrored -\expandafter\let\csname\??mathleft \meaning .\endcsname\Rnothingmirrored - -\expandafter\let\csname\??mathleft \meaning ⌊\endcsname\Lfloor -\expandafter\let\csname\??mathright\meaning ⌋\endcsname\Rfloor -\expandafter\let\csname\??mathleft \meaning ⌈\endcsname\Lceil -\expandafter\let\csname\??mathright\meaning ⌉\endcsname\Rceil +\normalexpanded{\installmathfencepair {|\detokenize {|}} \Ldoublebar {|\detokenize {|}} \Rdoublebar} +\normalexpanded{\installmathfencepair {|\detokenize{||}} \Ltriplebar {|\detokenize{||}} \Rtriplebar} + +\installmathfencepair \bgroup \Lbrace \egroup \Rbrace +\installmathfencepair \egroup \Rbracemirrored \bgroup \Lbracemirrored + +\installmathfencepair . \Lnothing . \Rnothing +\installmathfencepair . \Rnothingmirrored . \Lnothingmirrored + +\installmathfencepair [ \Lbracket ] \Rbracket +\installmathfencepair ] \Rbracketmirrored [ \Lbracketmirrored + +\installmathfencepair ( \Lparent ) \Rparent +\installmathfencepair ) \Rparentmirrored ( \Lparentmirrored + +\installmathfencepair < \Langle > \Rangle +\installmathfencepair > \Ranglemirrored < \Langlemirrored + +\installmathfencepair / \Lsolidus / \Rsolidus +%installmathfencepair / \Rsolidusmirrored / \Lsolidusmirrored + +\installmathfencepair | \Lbar | \Rbar +%installmathfencepair | \Rbarmirrored | \Lbarmirrored + +\installmathfencepair ⌊ \Lfloor ⌋ \Rfloor +\installmathfencepair ⌋ \Rfloormirrored ⌊ \Lfloormirrored +\installmathfencepair ⌈ \Lceil ⌉ \Rceil +\installmathfencepair ⌉ \Rceilmirrored ⌈ \Lceilmirrored + +\installmathfencepair ⟨ \Langle ⟩ \Rangle +\installmathfencepair ⟩ \Ranglemirrored ⟨ \Langlemirrored + +\installmathfencepair ⟪ \Ldoubleangle ⟫ \Rdoubleangle +\installmathfencepair ⟫ \Rdoubleanglemirrored ⟪ \Ldoubleanglemirrored + +\installmathfencepair ‖ \Ldoublebar ‖ \Rdoublebar +%installmathfencepair ‖ \Rdoublebarmirrored ‖ \Ldoublebarmirrored + +\installmathfencepair ⦀ \Ltriplebar ⦀ \Rtriplebar +%installmathfencepair ⦀ \Rtriplebarmirrored ⦀ \Ltriplebarmirrored + +% \installmathfencepair { \Lbrace } \Rbrace +% \installmathfencepair } \Rbracemirrored { \Lbracemirrored % todo paren parent diff --git a/tex/context/base/math-ini.mkiv b/tex/context/base/math-ini.mkiv index d18c66812..16efd35a3 100644 --- a/tex/context/base/math-ini.mkiv +++ b/tex/context/base/math-ini.mkiv @@ -603,6 +603,9 @@ \box\scratchbox \endgroup} +\unexpanded\def\mtext#1% + {\text{\usemathematicsstyleandcolor\c!textstyle\c!textcolor#1}} + %D The next hack is needed needed for sine, cosine etc. \let\mathfunction\firstofoneunexpanded @@ -803,6 +806,13 @@ % \activatemathcharacter\primeasciicode +% not needed: +% +% \activatemathcharacter\barasciicode +% \appendtoks +% \let |\letterbar +% \to \everymathematics + % not used: % % \mathcode\spaceasciicode\activemathcharcode diff --git a/tex/context/base/mult-def.mkiv b/tex/context/base/mult-def.mkiv index fb7f2b182..b2fc1cfcf 100644 --- a/tex/context/base/mult-def.mkiv +++ b/tex/context/base/mult-def.mkiv @@ -34,10 +34,12 @@ % start todo in mult-def.lua: -\def\v!sansnormal {sansnormal} -%def\v!sansbold {sansbold} \def\v!serifnormal {serifnormal} \def\v!serifbold {serifbold} +\def\v!sansnormal {sansnormal} +%def\v!sansbold {sansbold} +\def\v!mononormal {mononormal} +\def\v!monobold {monobold} \def\c!functionstyle {functionstyle} \def\c!functioncolor {functioncolor} diff --git a/tex/context/base/publ-aut.lua b/tex/context/base/publ-aut.lua index 4c95d0025..185d99efc 100644 --- a/tex/context/base/publ-aut.lua +++ b/tex/context/base/publ-aut.lua @@ -261,9 +261,7 @@ local function splitauthor(author) end local function splitauthorstring(str) - if str then - -- str = lpegmatch(cleaner,str) - else + if not str or str == "" then return end nofused = nofused + 1 @@ -284,7 +282,7 @@ local function splitauthorstring(str) -- we could cache these too but it can become messy .. leave that for later - local authors = lpegmatch(andsplitter,str) + local authors = lpegmatch(andsplitter,str) or { } -- maybe fake an author local nofauthors = #authors for i=1,nofauthors do authors[i] = splitauthor(authors[i]) @@ -763,7 +761,7 @@ authorhashers.short = function(authors) return concat(t) end else - return utfsub(authors,1,4) + return utfsub(authors,1,3) end end @@ -854,7 +852,7 @@ publications.components.author = components publications.sortmethods.authoryear = { sequence = { - { field = "key", default = "", unknown = "" }, + { field = "key", default = "ZZZZ", unknown = "ZZZZ" }, { field = "author", default = "", unknown = "" }, { field = "year", default = "9998", unknown = "9999" }, -- { field = "suffix", default = " ", unknown = " " }, diff --git a/tex/context/base/publ-imp-aps.mkvi b/tex/context/base/publ-imp-aps.mkvi index a173e0e4c..9772fbb87 100644 --- a/tex/context/base/publ-imp-aps.mkvi +++ b/tex/context/base/publ-imp-aps.mkvi @@ -755,10 +755,10 @@ \btxspace \btxflush{pages} } - \btxleftparenthesis - \texdefinition{btx:aps:year} - \btxrightparenthesis } + \btxleftparenthesis + \texdefinition{btx:aps:year} + \btxrightparenthesis \stoptexdefinition \starttexdefinition btx:aps:publisher-wherefrom-year @@ -967,7 +967,9 @@ \btxflush{country} } } - \btxperiod + \btxleftparenthesis + \texdefinition{btx:aps:year} + \btxrightparenthesis \texdefinition{btx:aps:note} \stopsetups @@ -1061,8 +1063,10 @@ \btxdoif {howpublished} { \btxspace \btxflush{howpublished} - \btxperiod } + \btxleftparenthesis + \texdefinition{btx:aps:year} + \btxrightparenthesis \texdefinition{btx:aps:note} \stopsetups @@ -1079,14 +1083,8 @@ % Optional fields: author, title, howpublished, month, year, note. \startsetups btx:aps:list:misc - \texdefinition{btx:aps:author} - \texdefinition{btx:aps:title} - \btxdoif {howpublished} { - \btxspace - \btxflush{howpublished} - \btxperiod - } - \texdefinition{btx:aps:note} + \fastsetup{btx:aps:list:electronic} + % Note that organization is an "ignored" field. \stopsetups % If all else fails to match: diff --git a/tex/context/base/publ-ini.lua b/tex/context/base/publ-ini.lua index e7aa1fa67..4f7dd4413 100644 --- a/tex/context/base/publ-ini.lua +++ b/tex/context/base/publ-ini.lua @@ -1548,7 +1548,7 @@ do function publications.loaddefinitionfile(name) -- a more specific name resolvers.uselibrary { - name = string.gsub(name,"^publ%-",""), + name = gsub(name,"^publ%-",""), patterns = patterns, action = action, failure = failure, @@ -1562,7 +1562,7 @@ do function publications.loadreplacementfile(name) -- a more specific name resolvers.uselibrary { - name = string.gsub(name,"^publ%-",""), + name = gsub(name,"^publ%-",""), patterns = patterns, action = publications.loaders.registercleaner, failure = failure, diff --git a/tex/context/base/publ-ini.mkiv b/tex/context/base/publ-ini.mkiv index cdbc03df0..2d55832f9 100644 --- a/tex/context/base/publ-ini.mkiv +++ b/tex/context/base/publ-ini.mkiv @@ -631,7 +631,7 @@ \btxparameter\c!right}% \endgroup} -\unexpanded\def\btxpagesetup#1% there will b eno left|right|command|style at this inner level +\unexpanded\def\btxpagesetup#1% there will b eno left|right|command|style at this inner level {\begingroup \publ_fast_setup\plusfive\s!list\s!page \endgroup @@ -1358,6 +1358,12 @@ \let\nocite \btxnocitation \let\nocitation\btxnocitation +\unexpanded\def\cite {\doifelsenextoptionalcs\btxcitation \btxdirectcite} +\unexpanded\def\nocite{\doifelsenextoptionalcs\btxnocitation\btxdirectnocite} + +\unexpanded\def\btxdirectcite #1{\btxcitation [#1]\relax} % no optional arguments +\unexpanded\def\btxdirectnocite#1{\btxnocitation[#1]\relax} % no optional arguments + %D Setup helpers, beware, we need to wrap this .. now we need to know %D how setups are implemented. diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf Binary files differindex 2b4ff5249..bc804670a 100644 --- a/tex/context/base/status-files.pdf +++ b/tex/context/base/status-files.pdf diff --git a/tex/context/base/status-lua.pdf b/tex/context/base/status-lua.pdf Binary files differindex 3bee47f14..99c615fd9 100644 --- a/tex/context/base/status-lua.pdf +++ b/tex/context/base/status-lua.pdf diff --git a/tex/context/base/strc-lst.lua b/tex/context/base/strc-lst.lua index 4c9a7217e..fd79bbd7a 100644 --- a/tex/context/base/strc-lst.lua +++ b/tex/context/base/strc-lst.lua @@ -1210,8 +1210,8 @@ implement { } implement { - name = "savedlistprefixednumber", - actions = savedlistprefixednumber, + name = "savedlistprefixednumber", + actions = savedlistprefixednumber, arguments = { "string", "integer" } } diff --git a/tex/context/base/strc-lst.mkvi b/tex/context/base/strc-lst.mkvi index c8bcb0ed3..71fc09829 100644 --- a/tex/context/base/strc-lst.mkvi +++ b/tex/context/base/strc-lst.mkvi @@ -339,6 +339,10 @@ \def\currentlistmethod {entry} % typesetting \def\currentlistindex {0} % typesetting (maybe also a real counter) +\unexpanded\def\savedlistnumber #1#2{\clf_savedlistnumber {#1}\numexpr#2\relax} +\unexpanded\def\savedlisttitle #1#2{\clf_savedlisttitle {#1}\numexpr#2\relax} +\unexpanded\def\savedlistprefixednumber#1#2{\clf_savedlistprefixednumber{#1}\numexpr#2\relax} + \def\structurelistlocation {\clf_listlocation\numexpr\currentlistindex\relax} diff --git a/tex/context/base/x-asciimath.lua b/tex/context/base/x-asciimath.lua index 71d08f499..efa6a7736 100644 --- a/tex/context/base/x-asciimath.lua +++ b/tex/context/base/x-asciimath.lua @@ -957,18 +957,9 @@ for k, v in sortedhash(reserved) do k_reserved_different[#k_reserved_different+1] = k end end - -for k, v in next, entities do - if not k_unicode[k] then - k_unicode[k] = v - k_unicode["\\"..k] = v + if not find(k,"[^[a-zA-Z]+$]") then + k_unicode["\\"..k] = k -- dirty trick, no real unicode end -end - -if not find(k,"[^[a-zA-Z]+$]") then - k_unicode["\\"..k] = k -- dirty trick, no real unicode -end - if not find(k,"[^a-zA-Z]") then k_reserved_words[#k_reserved_words+1] = k end @@ -981,6 +972,8 @@ local p_reserved = local p_unicode = lpeg.utfchartabletopattern(table.keys(k_unicode)) / k_unicode +-- inspect(k_reserved_different) + local p_texescape = patterns.texescape local function texescaped(s) @@ -1030,8 +1023,8 @@ local m_right = { ["]"] = s_rbracket, ["}"] = s_rbrace, ["⟩"] = s_rangle, - ["⌉"] = s_rceil, - ["⌋"] = s_rfloor, + ["⌉"] = s_rceil, + ["⌋"] = s_rfloor, -- [">>"] = s_rangle, -- why not :> -- ["~|"] = s_rceil, @@ -1088,12 +1081,6 @@ local p_special = -- open | close :: {: | :} --- local e_parser = Cs ( ( --- p_entity + --- p_utf_base --- )^0 ) - - local u_parser = Cs ( ( patterns.doublequoted + P("text") * p_spaces^0 * P("(") * (1-P(")"))^0 * P(")") + -- -- todo: balanced @@ -1125,9 +1112,8 @@ local function show_state(t,level,state) report_asciimath(serialize(t,f_state(level,state))) end -local function show_result(original,entified,unicoded,texcoded) +local function show_result(original,unicoded,texcoded) report_asciimath("original > %s",original) - report_asciimath("entified > %s",entified) report_asciimath("unicoded > %s",unicoded) report_asciimath("texcoded > %s",texcoded) end @@ -1301,9 +1287,10 @@ local function collapse_signs(t) if isunary[current] then local one = t[i+1] if not one then - m = m + 1 +-- m = m + 1 t[m] = current .. "{}" -- error - break +return t +-- break end if type(one) == "table" then if isleft[one[1]] and isright[one[#one]] then @@ -1371,7 +1358,8 @@ local function collapse_binaries(t) local two = t[i+2] if not one then t[m] = current .. "{}{}" -- error - break +return t +-- break end if type(one) == "table" then if isleft[one[1]] and isright[one[#one]] then @@ -1382,7 +1370,8 @@ local function collapse_binaries(t) end if not two then t[m] = current .. "{" .. one .. "}{}" - break +return t +-- break end if type(two) == "table" then if isleft[two[1]] and isright[two[#two]] then @@ -1668,11 +1657,10 @@ local ctx_type = context and context.type or function() end local ctx_inleft = context and context.inleft or function() end local function convert(str,totex) - local entified = str -- lpegmatch(e_parser,str) or str -- when used in text - local unicoded = lpegmatch(u_parser,entified) or entified + local unicoded = lpegmatch(u_parser,str) or str local texcoded = collapse(lpegmatch(a_parser,unicoded)) if trace_mapping then - show_result(str,entified,unicoded,texcoded) + show_result(str,unicoded,texcoded) end if totex then ctx_mathematics(texcoded) @@ -1820,16 +1808,24 @@ asciimath.cleanedup = cleanedup -- sin(x) = 1 : 3.3 uncached 1.2 cached , so no real gain (better optimize the converter then) +local uncrapped = { + ["%"] = "\\mathpercent", + ["&"] = "\\mathampersand", + ["#"] = "\\mathhash", + ["$"] = "\\mathdollar", + ["^"] = "\\Hat{\\enspace}", -- terrible hack ... tex really does it sbest to turn any ^ into a superscript + ["_"] = "\\underline{\\enspace}", +} + local function convert(str) if #str > 0 then - local entified = str -- lpegmatch(e_parser,str) or str -- when used in text - local unicoded = lpegmatch(u_parser,entified) or entified + local unicoded = lpegmatch(u_parser,str) or str if lpegmatch(p_onechar,unicoded) then - ctx_mathematics(unicoded) + ctx_mathematics(uncrapped[unicoded] or unicoded) else local texcoded = collapse(lpegmatch(a_parser,unicoded)) if trace_mapping then - show_result(str,entified,unicoded,texcoded) + show_result(str,unicoded,texcoded) end if #texcoded == 0 then report_asciimath("error in asciimath: %s",str) @@ -1846,6 +1842,7 @@ local function convert(str) end end + local context = context if not context then @@ -1858,6 +1855,10 @@ if not context then -- report_asciimath(cleanedup([[a "α" b]])) -- report_asciimath(cleanedup([[//4]])) +-- convert([[\^{1/5}log]]) +-- convert("sqrt") +-- convert("^") + -- convert("\\frac{a}{b}") -- convert("frac{a}{b}") -- convert("\\sin{a}{b}") @@ -2090,5 +2091,3 @@ end function show.save(name) table.save(name ~= "" and name or "dummy.lua",collected) end - --- inspect(sortedkeys(reserved)) diff --git a/tex/context/base/x-calcmath.lua b/tex/context/base/x-calcmath.lua index 1394f3450..c96d8d0ac 100644 --- a/tex/context/base/x-calcmath.lua +++ b/tex/context/base/x-calcmath.lua @@ -16,6 +16,8 @@ local calcmath = { } local moduledata = moduledata or { } moduledata.calcmath = calcmath +local context = context + local list_1 = { "median", "min", "max", "round", "ln", "log", "sin", "cos", "tan", "sinh", "cosh", "tanh" @@ -46,8 +48,8 @@ local function freeze() for k=1,#list_2 do local v = list_2[k] list_2_1[v .. "%((.-),(.-),(.-)%)"] = "\\" .. upper(v) .. "^{%1}_{%2}{%3}" - list_2_2[v .. "%((.-),(.-)%)"] = "\\" .. upper(v) .. "^{%1}{%2}" - list_2_3[v .. "%((.-)%)"] = "\\" .. upper(v) .. "{%1}" + list_2_2[v .. "%((.-),(.-)%)"] = "\\" .. upper(v) .. "^{%1}{%2}" + list_2_3[v .. "%((.-)%)"] = "\\" .. upper(v) .. "{%1}" end for k=1,#list_4 do local v = list_4[k] @@ -192,7 +194,6 @@ if false then -- Df Dg {\rm f}^{\prime} -- f() g() {\rm f}() - -- valid utf8 local S, P, R, C, V, Cc, Ct = lpeg.S, lpeg.P, lpeg.R, lpeg.C, lpeg.V, lpeg.Cc, lpeg.Ct diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 5d2748b53..ead4e2aea 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 : 05/11/15 21:53:45 +-- merge date : 05/12/15 17:57:50 do -- begin closure to overcome local limits and interference |