summaryrefslogtreecommitdiff
path: root/tex
diff options
context:
space:
mode:
Diffstat (limited to 'tex')
-rw-r--r--tex/context/base/back-ini.lua2
-rw-r--r--tex/context/base/chem-str.lua12
-rw-r--r--tex/context/base/colo-ini.lua3
-rw-r--r--tex/context/base/context-version.pdfbin4101 -> 4140 bytes
-rw-r--r--tex/context/base/context-version.pngbin40367 -> 40011 bytes
-rw-r--r--tex/context/base/lpdf-ini.lua2
-rw-r--r--tex/context/base/status-files.pdfbin24411 -> 24488 bytes
-rw-r--r--tex/context/base/status-lua.pdfbin199573 -> 199214 bytes
-rw-r--r--tex/context/base/syst-con.lua11
-rw-r--r--tex/context/base/syst-con.mkiv10
-rw-r--r--tex/context/base/type-imp-lucida-opentype.mkiv4
-rw-r--r--tex/context/base/util-prs.lua74
12 files changed, 93 insertions, 25 deletions
diff --git a/tex/context/base/back-ini.lua b/tex/context/base/back-ini.lua
index f76b85438..f6b2f60f1 100644
--- a/tex/context/base/back-ini.lua
+++ b/tex/context/base/back-ini.lua
@@ -97,6 +97,6 @@ tables.vfspecials = allocate {
function commands.pdfrotation(a) -- somewhat weird here
local s, c = sind(a), cosd(a)
- context("%s %s %s %s",c,s,-s,c)
+ context("%0.6f %0.6f %0.6f %0.6f",c,s,-s,c)
end
diff --git a/tex/context/base/chem-str.lua b/tex/context/base/chem-str.lua
index 83cfba6bf..8c154cc36 100644
--- a/tex/context/base/chem-str.lua
+++ b/tex/context/base/chem-str.lua
@@ -31,6 +31,7 @@ local format, gmatch, match, lower, gsub = string.format, string.gmatch, string.
local concat, insert, remove = table.concat, table.insert, table.remove
local processor_tostring = typesetters and typesetters.processors.tostring
local settings_to_array = utilities.parsers.settings_to_array
+local settings_to_array_with_repeat = utilities.parsers.settings_to_array_with_repeat
local lpegmatch = lpeg.match
local P, R, S, C, Cs, Ct, Cc = lpeg.P, lpeg.R, lpeg.S, lpeg.C, lpeg.Cs, lpeg.Ct, lpeg.Cc
@@ -216,8 +217,8 @@ function chemistry.define(name,spec,text)
definitions[name] = dn
end
dn[#dn+1] = {
- spec = settings_to_array(lower(spec)),
- text = settings_to_array(text),
+ spec = settings_to_array_with_repeat(lower(spec),true),
+ text = settings_to_array_with_repeat(text,true),
}
end
@@ -582,8 +583,9 @@ end
function chemistry.component(spec,text,settings)
rulethickness, rulecolor, offset = settings.rulethickness, settings.rulecolor
- local spec = settings_to_array(spec)
- local text = settings_to_array(text)
+ local spec = settings_to_array_with_repeat(spec,true) -- no lower?
+ local text = settings_to_array_with_repeat(text,true)
+-- inspect(spec)
metacode[#metacode+1] = t_start_component
process(spec,text,1,rulethickness,rulecolor) -- offset?
metacode[#metacode+1] = t_stop_component
@@ -619,7 +621,7 @@ local inline = {
}
function commands.inlinechemical(spec)
- local spec = settings_to_array(spec)
+ local spec = settings_to_array_with_repeat(spec,true)
for i=1,#spec do
local s = spec[i]
local inl = inline[lower(s)]
diff --git a/tex/context/base/colo-ini.lua b/tex/context/base/colo-ini.lua
index 51f66025e..4fdbf4545 100644
--- a/tex/context/base/colo-ini.lua
+++ b/tex/context/base/colo-ini.lua
@@ -288,7 +288,8 @@ local right = P(")")
local comma = P(",")
local mixnumber = lpegpatterns.number / tonumber
local mixname = C(P(1-left-right-comma)^1)
-local mixcolor = Cc("M") * mixnumber * left * mixname * (comma * mixname)^-1 * right * P(-1)
+----- mixcolor = Cc("M") * mixnumber * left * mixname * (comma * mixname)^-1 * right * P(-1)
+local mixcolor = Cc("M") * mixnumber * left * mixname * (comma * mixname)^0 * right * P(-1) -- one is also ok
local exclamation = P("!")
local pgfnumber = lpegpatterns.digit^0 / function(s) return tonumber(s)/100 end
diff --git a/tex/context/base/context-version.pdf b/tex/context/base/context-version.pdf
index b42a55d11..4f4f7a4d8 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 492244e80..bb7d07636 100644
--- a/tex/context/base/context-version.png
+++ b/tex/context/base/context-version.png
Binary files differ
diff --git a/tex/context/base/lpdf-ini.lua b/tex/context/base/lpdf-ini.lua
index 88999358c..1591d6da1 100644
--- a/tex/context/base/lpdf-ini.lua
+++ b/tex/context/base/lpdf-ini.lua
@@ -703,7 +703,7 @@ registerpagefinalizer(checkshades,3,"shades")
function lpdf.rotationcm(a)
local s, c = sind(a), cosd(a)
- return format("%s %s %s %s 0 0 cm",c,s,-s,c)
+ return format("%0.6f %0.6f %0.6f %0.6f 0 0 cm",c,s,-s,c)
end
-- ! -> universaltime
diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf
index 3d9408372..905dd140f 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 0340c0484..cdc59418d 100644
--- a/tex/context/base/status-lua.pdf
+++ b/tex/context/base/status-lua.pdf
Binary files differ
diff --git a/tex/context/base/syst-con.lua b/tex/context/base/syst-con.lua
index 2eaf98fd7..f3f1b98cf 100644
--- a/tex/context/base/syst-con.lua
+++ b/tex/context/base/syst-con.lua
@@ -39,3 +39,14 @@ function commands.format(fmt,...) -- used ?
fmt = gsub(fmt,"@","%%")
context(fmt,...)
end
+
+local cosd, sind, tand = math.cosd, math.sind, math.tand
+local cos, sin, tan = math.cos, math.sin, math.tan
+
+function commands.sind(n) context("%0.6f",sind(n)) end
+function commands.cosd(n) context("%0.6f",cosd(n)) end
+function commands.tand(n) context("%0.6f",tand(n)) end
+
+function commands.sin(n) context("%0.6f",sin(n)) end
+function commands.cos(n) context("%0.6f",cos(n)) end
+function commands.tan(n) context("%0.6f",tan(n)) end
diff --git a/tex/context/base/syst-con.mkiv b/tex/context/base/syst-con.mkiv
index 6ef734c8f..de8ed597e 100644
--- a/tex/context/base/syst-con.mkiv
+++ b/tex/context/base/syst-con.mkiv
@@ -134,9 +134,13 @@
% \let\calculatecos\gobbleoneargument
% \let\calculatetan\gobbleoneargument
-\def\setcalculatedsin#1#2{\edef#1{\cldcontext{math.sind(#2)}}}
-\def\setcalculatedcos#1#2{\edef#1{\cldcontext{math.cosd(#2)}}}
-\def\setcalculatedtan#1#2{\edef#1{\cldcontext{math.tand(#2)}}}
+% \def\setcalculatedsin#1#2{\edef#1{\cldcontext{math.sind(#2)}}} % jit-unsafe
+% \def\setcalculatedcos#1#2{\edef#1{\cldcontext{math.cosd(#2)}}} % jit-unsafe
+% \def\setcalculatedtan#1#2{\edef#1{\cldcontext{math.tand(#2)}}} % jit-unsafe
+
+\def\setcalculatedsin#1#2{\edef#1{\ctxcommand{sind(#2)}}}
+\def\setcalculatedcos#1#2{\edef#1{\ctxcommand{cosd(#2)}}}
+\def\setcalculatedtan#1#2{\edef#1{\ctxcommand{tand(#2)}}}
\def\formatted#1{\ctxcommand{format(#1)}}
\unexpanded\def\format #1{\ctxcommand{format(#1)}}
diff --git a/tex/context/base/type-imp-lucida-opentype.mkiv b/tex/context/base/type-imp-lucida-opentype.mkiv
index 8c4ff3bba..63a331cad 100644
--- a/tex/context/base/type-imp-lucida-opentype.mkiv
+++ b/tex/context/base/type-imp-lucida-opentype.mkiv
@@ -56,8 +56,8 @@
\stoptypescript
\starttypescript [\s!math] [lucidanova,lucidaot,otlucida]
- \definefontsynonym [\s!MathRoman] [\s!file:LucidaBrightMathOT.otf] [\s!features=\s!math\mathsizesuffix,\s!goodies=lucidanova-math]
- \definefontsynonym [\s!MathRomanBold] [\s!file:LucidaBrightMathOT-Demi.otf] [\s!features=\s!math\mathsizesuffix,\s!goodies=lucidanova-math]
+ \definefontsynonym [\s!MathRoman] [\s!file:LucidaBrightMathOT.otf] [\s!features=\s!math\mathsizesuffix,\s!goodies=lucida-opentype-math]
+ \definefontsynonym [\s!MathRomanBold] [\s!file:LucidaBrightMathOT-Demi.otf] [\s!features=\s!math\mathsizesuffix,\s!goodies=lucida-opentype-math]
\stoptypescript
\starttypescript [\s!handwriting] [lucidanova,lucidaot,otlucida]
diff --git a/tex/context/base/util-prs.lua b/tex/context/base/util-prs.lua
index 3cfb3e5f3..dc1526df7 100644
--- a/tex/context/base/util-prs.lua
+++ b/tex/context/base/util-prs.lua
@@ -23,11 +23,14 @@ local sortedhash = table.sortedhash
-- we share some patterns
+local digit = R("09")
local space = P(' ')
local equal = P("=")
local comma = P(",")
local lbrace = P("{")
local rbrace = P("}")
+local lparent = P("(")
+local rparent = P(")")
local period = S(".")
local punctuation = S(".,:;")
local spacer = patterns.spacer
@@ -36,6 +39,9 @@ local newline = patterns.newline
local anything = patterns.anything
local endofstring = patterns.endofstring
+local nobrace = 1 - ( lbrace + rbrace )
+local noparent = 1 - ( lparent + rparent)
+
-- we could use a Cf Cg construct
local escape, left, right = P("\\"), P('{'), P('}')
@@ -45,17 +51,19 @@ patterns.balanced = P {
[2] = left * V(1) * right
}
-local nobrace = 1 - (lbrace+rbrace)
-local nested = P { lbrace * (nobrace + V(1))^0 * rbrace }
-local spaces = space^0
-local argument = Cs((lbrace/"") * ((nobrace + nested)^0) * (rbrace/""))
-local content = (1-endofstring)^0
+local nestedbraces = P { lbrace * (nobrace + V(1))^0 * rbrace }
+local nestedparents = P { lparent * (noparent + V(1))^0 * rparent }
+local spaces = space^0
+local argument = Cs((lbrace/"") * ((nobrace + nestedbraces)^0) * (rbrace/""))
+local content = (1-endofstring)^0
-patterns.nested = nested -- no capture
-patterns.argument = argument -- argument after e.g. =
-patterns.content = content -- rest after e.g =
+patterns.nestedbraces = nestedbraces -- no capture
+patterns.nestedparents = nestedparents -- no capture
+patterns.nested = nestedbraces -- no capture
+patterns.argument = argument -- argument after e.g. =
+patterns.content = content -- rest after e.g =
-local value = P(lbrace * C((nobrace + nested)^0) * rbrace) + C((nested + (1-comma))^0)
+local value = P(lbrace * C((nobrace + nestedbraces)^0) * rbrace) + C((nestedbraces + (1-comma))^0)
local key = C((1-equal-comma)^1)
local pattern_a = (space+comma)^0 * (key * equal * value + key * C(""))
@@ -125,7 +133,8 @@ function parsers.settings_to_hash_strict(str,existing)
end
local separator = comma * space^0
-local value = P(lbrace * C((nobrace + nested)^0) * rbrace) + C((nested + (1-comma))^0)
+local value = P(lbrace * C((nobrace + nestedbraces)^0) * rbrace)
+ + C((nestedbraces + (1-comma))^0)
local pattern = spaces * Ct(value*(separator*value)^0)
-- "aap, {noot}, mies" : outer {} removes, leading spaces ignored
@@ -220,7 +229,49 @@ function parsers.simple_hash_to_string(h, separator)
return concat(t,separator or ",")
end
-local value = lbrace * C((nobrace + nested)^0) * rbrace
+-- for chem (currently one level)
+
+local value = P(lbrace * C((nobrace + nestedbraces)^0) * rbrace)
+ + C(digit^1 * lparent * (noparent + nestedparents)^0 * rparent)
+ + C((nestedbraces + (1-comma))^0)
+local pattern_a = spaces * Ct(value*(separator*value)^0)
+
+local function repeater(n,str)
+ if not n then
+ return str
+ else
+ local s = lpegmatch(pattern_a,str)
+ if n == 1 then
+ return unpack(s)
+ else
+ local t, tn = { }, 0
+ for i=1,n do
+ for j=1,#s do
+ tn = tn + 1
+ t[tn] = s[j]
+ end
+ end
+ return unpack(t)
+ end
+ end
+end
+
+local value = P(lbrace * C((nobrace + nestedbraces)^0) * rbrace)
+ + (C(digit^1)/tonumber * lparent * Cs((noparent + nestedparents)^0) * rparent) / repeater
+ + C((nestedbraces + (1-comma))^0)
+local pattern_b = spaces * Ct(value*(separator*value)^0)
+
+function parsers.settings_to_array_with_repeat(str,expand)
+ if expand then
+ return lpegmatch(pattern_b,str)
+ else
+ return lpegmatch(pattern_a,str)
+ end
+end
+
+--
+
+local value = lbrace * C((nobrace + nestedbraces)^0) * rbrace
local pattern = Ct((space + value)^0)
function parsers.arguments_to_table(str)
@@ -251,7 +302,6 @@ function parsers.listitem(str)
end
--
-local digit = R("09")
local pattern = Cs { "start",
start = V("one") + V("two") + V("three"),