summaryrefslogtreecommitdiff
path: root/tex
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2012-08-10 19:40:00 +0200
committerHans Hagen <pragma@wxs.nl>2012-08-10 19:40:00 +0200
commitfda5a913473511bc21c6424069fcbd520d12b6f0 (patch)
tree52ffb3158983f3eafd3a3cd4831c894bc9c6d0cc /tex
parentb9367ecbb2e7dcb9993f2cf30e56c3e4031edfa8 (diff)
downloadcontext-fda5a913473511bc21c6424069fcbd520d12b6f0.tar.gz
beta 2012.08.10 19:40
Diffstat (limited to 'tex')
-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.pdfbin4083 -> 4085 bytes
-rw-r--r--tex/context/base/context-version.pngbin106289 -> 106470 bytes
-rw-r--r--tex/context/base/context.mkii2
-rw-r--r--tex/context/base/context.mkiv2
-rw-r--r--tex/context/base/l-lpeg.lua29
-rw-r--r--tex/context/base/l-os.lua12
-rw-r--r--tex/context/base/luat-env.lua26
-rw-r--r--tex/context/base/lxml-lpt.lua17
-rw-r--r--tex/context/base/lxml-tab.lua4
-rw-r--r--tex/context/base/m-spreadsheet.lua8
-rw-r--r--tex/context/base/m-spreadsheet.mkiv2
-rw-r--r--tex/context/base/mult-def.mkiv2
-rw-r--r--tex/context/base/mult-low.lua2
-rw-r--r--tex/context/base/status-files.pdfbin24437 -> 24430 bytes
-rw-r--r--tex/context/base/status-lua.pdfbin190377 -> 190389 bytes
-rw-r--r--tex/context/base/strc-tag.lua1
-rw-r--r--tex/context/base/strc-tag.mkiv1
-rw-r--r--tex/context/base/supp-box.mkiv7
-rw-r--r--tex/context/base/typo-scr.mkiv249
-rw-r--r--tex/generic/context/luatex/luatex-fonts-merged.lua31
22 files changed, 322 insertions, 77 deletions
diff --git a/tex/context/base/cont-new.mkii b/tex/context/base/cont-new.mkii
index 6b6fc5b67..cf0b9bc4f 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.08.10 00:32}
+\newcontextversion{2012.08.10 19: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/cont-new.mkiv b/tex/context/base/cont-new.mkiv
index 60612b657..c1eb31960 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.08.10 00:32}
+\newcontextversion{2012.08.10 19: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/context-version.pdf b/tex/context/base/context-version.pdf
index bd6ba9775..c2b73175e 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 07dca37eb..738fa1b3f 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 e5b8e6591..b173fe811 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.08.10 00:32}
+\edef\contextversion{2012.08.10 19:40}
%D For those who want to use this:
diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv
index 7d9f444f5..6ee088294 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.08.10 00:32}
+\edef\contextversion{2012.08.10 19:40}
%D For those who want to use this:
diff --git a/tex/context/base/l-lpeg.lua b/tex/context/base/l-lpeg.lua
index fa3b210af..70c5f14e1 100644
--- a/tex/context/base/l-lpeg.lua
+++ b/tex/context/base/l-lpeg.lua
@@ -15,6 +15,23 @@ local lpeg = require("lpeg")
local report = texio and texio.write_nl or print
+-- Watch this: Lua does some juggling with replacement values and although lpeg itself is agnostic of
+-- % characters, the replacement isn't. Now, in all of the context sources these are only a few cases
+-- where capture replacement instring happens. Interesting is that the string parsing already happens
+-- when the lpeg is made, but nevertheless is a not that useful (at least for me) feature that has the
+-- side effect that one always has to do %% in order to get a %. Okay, now that I know it is there, I
+-- might use it more often.
+--
+-- local p = P("@") / "%"
+-- lpeg.print(p) print(lpeg.match(p,"@"))
+--
+-- local p = P("@") / "%%"
+-- lpeg.print(p) print(lpeg.match(p,"@"))
+--
+-- local p = C("@") * C("!") / "%2%1"
+-- lpeg.print(p) print(lpeg.match(p,"@!"))
+
+
-- local lpmatch = lpeg.match
-- local lpprint = lpeg.print
-- local lpp = lpeg.P
@@ -50,7 +67,7 @@ local report = texio and texio.write_nl or print
-- function lpeg.Carg (l) local p = lpcarg(l) report("LPEG Carg =") lpprint(l) return p end
local type = type
-local byte, char, gmatch = string.byte, string.char, string.gmatch
+local byte, char, gmatch, format = string.byte, string.char, string.gmatch, string.format
-- Beware, we predefine a bunch of patterns here and one reason for doing so
-- is that we get consistent behaviour in some of the visualizers.
@@ -766,3 +783,13 @@ end
-- utfchar(0x202F), -- narrownobreakspace
-- utfchar(0x205F), -- math thinspace
-- } )
+
+-- handy from within tex:
+
+local lpegmatch = lpeg.match
+
+local replacer = lpeg.replacer("@","%%") -- Watch the escaped % in lpeg!
+
+function string.tformat(fmt,...)
+ return format(lpegmatch(replacer,fmt),...)
+end
diff --git a/tex/context/base/l-os.lua b/tex/context/base/l-os.lua
index f9bd46e51..7c9ce307b 100644
--- a/tex/context/base/l-os.lua
+++ b/tex/context/base/l-os.lua
@@ -136,12 +136,14 @@ else
os.libsuffix, os.binsuffix, os.binsuffixes = 'so', '', { '' }
end
+local launchers = {
+ windows = "start %s",
+ macosx = "open %s",
+ unix = "$BROWSER %s &> /dev/null &",
+}
+
function os.launch(str)
- if os.type == "windows" then
- os.execute("start " .. str) -- os.spawn ?
- else
- os.execute(str .. " &") -- os.spawn ?
- end
+ os.execute(format(launchers[os.name] or launchers.unix,str))
end
if not os.times then
diff --git a/tex/context/base/luat-env.lua b/tex/context/base/luat-env.lua
index 181e3b237..6e31b5a98 100644
--- a/tex/context/base/luat-env.lua
+++ b/tex/context/base/luat-env.lua
@@ -20,7 +20,7 @@ local allocate, mark = utilities.storage.allocate, utilities.storage.mark
local format, sub, match, gsub, find = string.format, string.sub, string.match, string.gsub, string.find
local unquoted, quoted = string.unquoted, string.quoted
-local concat = table.concat
+local concat, insert, remove = table.concat, table.insert, table.remove
local loadedluacode = utilities.lua.loadedluacode
-- precautions
@@ -39,8 +39,28 @@ if arg and (arg[0] == 'luatex' or arg[0] == 'luatex.exe') and arg[1] == "--luaon
for k=3,#arg do
arg[k-2] = arg[k]
end
- arg[#arg] = nil -- last
- arg[#arg] = nil -- pre-last
+ remove(arg) -- last
+ remove(arg) -- pre-last
+end
+
+-- This is an ugly hack but it permits symlinking a script (say 'context') to 'mtxrun' as in:
+--
+-- ln -s /opt/minimals/tex/texmf-linux-64/bin/mtxrun context
+--
+-- The special mapping hack is needed because 'luatools' boils down to 'mtxrun --script base'
+-- but it's unlikely that there will be more of this
+
+do
+
+ local originalzero = file.basename(arg[0])
+ local specialmapping = { luatools == "base" }
+
+ if originalzero ~= "mtxrun" and originalzero ~= "mtxrun.lua" then
+ arg[0] = specialmapping[originalzero] or originalzero
+ insert(arg,0,"--script")
+ insert(arg,0,"mtxrun")
+ end
+
end
-- environment
diff --git a/tex/context/base/lxml-lpt.lua b/tex/context/base/lxml-lpt.lua
index 37f07f030..b04c80550 100644
--- a/tex/context/base/lxml-lpt.lua
+++ b/tex/context/base/lxml-lpt.lua
@@ -539,14 +539,21 @@ local lp_builtin = P (
-- for the moment we keep namespaces with attributes
local lp_attribute = (P("@") + P("attribute::")) / "" * Cc("(ll.at and ll.at['") * ((R("az","AZ") + S("-_:"))^1) * Cc("'])")
-local lp_fastpos_p = ((P("+")^0 * R("09")^1 * P(-1)) / function(s) return "l==" .. s end)
-local lp_fastpos_n = ((P("-") * R("09")^1 * P(-1)) / function(s) return "(" .. s .. "<0 and (#list+".. s .. "==l))" end)
+
+----- lp_fastpos_p = (P("+")^0 * R("09")^1 * P(-1)) / function(s) return "l==" .. s end
+----- lp_fastpos_n = (P("-") * R("09")^1 * P(-1)) / function(s) return "(" .. s .. "<0 and (#list+".. s .. "==l))" end
+local lp_fastpos_p = (P("+")^0 * R("09")^1 * P(-1)) / "l==%1"
+local lp_fastpos_n = (P("-") * R("09")^1 * P(-1)) / "(%1<0 and (#list+%1==l))"
+
local lp_fastpos = lp_fastpos_n + lp_fastpos_p
+
local lp_reserved = C("and") + C("or") + C("not") + C("div") + C("mod") + C("true") + C("false")
-local lp_lua_function = C(R("az","AZ","__")^1 * (P(".") * R("az","AZ","__")^1)^1) * ("(") / function(t) -- todo: better . handling
- return t .. "("
-end
+-- local lp_lua_function = C(R("az","AZ","__")^1 * (P(".") * R("az","AZ","__")^1)^1) * ("(") / function(t) -- todo: better . handling
+-- return t .. "("
+-- end
+
+local lp_lua_function = C(R("az","AZ","__")^1 * (P(".") * R("az","AZ","__")^1)^1) * ("(") / "%1("
local lp_function = C(R("az","AZ","__")^1) * P("(") / function(t) -- todo: better . handling
if expressions[t] then
diff --git a/tex/context/base/lxml-tab.lua b/tex/context/base/lxml-tab.lua
index b5c860787..97ae924a1 100644
--- a/tex/context/base/lxml-tab.lua
+++ b/tex/context/base/lxml-tab.lua
@@ -907,7 +907,7 @@ function xml.checkbom(root) -- can be made faster
return
end
end
- insert(dt, 1, { special=true, ns="", tg="@pi@", dt = { "xml version='1.0' standalone='yes'"} } )
+ insert(dt, 1, { special = true, ns = "", tg = "@pi@", dt = { "xml version='1.0' standalone='yes'" } } )
insert(dt, 2, "\n" )
end
end
@@ -1317,7 +1317,7 @@ function xml.tocdata(e,wrapper) -- a few more in the aux module
if wrapper then
whatever = format("<%s>%s</%s>",wrapper,whatever,wrapper)
end
- local t = { special = true, ns = "", tg = "@cd@", at = {}, rn = "", dt = { whatever }, __p__ = e }
+ local t = { special = true, ns = "", tg = "@cd@", at = { }, rn = "", dt = { whatever }, __p__ = e }
setmetatable(t,getmetatable(e))
e.dt = { t }
end
diff --git a/tex/context/base/m-spreadsheet.lua b/tex/context/base/m-spreadsheet.lua
index 5ed44646d..049154f27 100644
--- a/tex/context/base/m-spreadsheet.lua
+++ b/tex/context/base/m-spreadsheet.lua
@@ -137,13 +137,7 @@ function functions.sum(c,f,t)
end
end
-function functions.fmt(pattern,n)
- if find(pattern,"^%%") then
- return format(pattern,n)
- else
- return format("%"..pattern,n)
- end
-end
+functions.fmt= string.tformat
local template = [[
local _m_ = moduledata.spreadsheets
diff --git a/tex/context/base/m-spreadsheet.mkiv b/tex/context/base/m-spreadsheet.mkiv
index c21e10f1d..e065ac7e8 100644
--- a/tex/context/base/m-spreadsheet.mkiv
+++ b/tex/context/base/m-spreadsheet.mkiv
@@ -144,7 +144,7 @@
\bTD[nx=2] \bf \getspr{string.format("\letterpercent0.3f",(A[3] + B[3]) /100)} \eTD
\eTR
\bTR
- \bTD[nx=2] \bf \getspr{fmt("0.3f",(sum(A,1,2)) / 10)} \eTD
+ \bTD[nx=2] \bf \getspr{fmt("@0.3f",(sum(A,1,2)) / 10)} \eTD
\eTR
\eTABLE
diff --git a/tex/context/base/mult-def.mkiv b/tex/context/base/mult-def.mkiv
index eed2e63ac..eade6496c 100644
--- a/tex/context/base/mult-def.mkiv
+++ b/tex/context/base/mult-def.mkiv
@@ -49,6 +49,8 @@
\def\c!monthconversion {monthconversion}
\def\c!comment {comment}
\def\c!textalign {textalign}
+\def\c!up {up}
+\def\c!down {down}
\def\v!compressseparator{compressseparator}
\def\v!notation {notation}
diff --git a/tex/context/base/mult-low.lua b/tex/context/base/mult-low.lua
index abc159f7c..047b4bdbd 100644
--- a/tex/context/base/mult-low.lua
+++ b/tex/context/base/mult-low.lua
@@ -271,6 +271,6 @@ return {
--
"startnointerference", "stopnointerference",
--
- "strut", "setstrut", "strutbox", "strutht", "strutdp", "strutwd", "begstrut", "endstrut", "lineheight",
+ "strut", "setstrut", "strutbox", "strutht", "strutdp", "strutwd", "struthtdp", "begstrut", "endstrut", "lineheight",
}
}
diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf
index db7eac92d..16ade95a6 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 2b53e30ec..17bbb0a67 100644
--- a/tex/context/base/status-lua.pdf
+++ b/tex/context/base/status-lua.pdf
Binary files differ
diff --git a/tex/context/base/strc-tag.lua b/tex/context/base/strc-tag.lua
index 78b807487..7e5c6f993 100644
--- a/tex/context/base/strc-tag.lua
+++ b/tex/context/base/strc-tag.lua
@@ -161,6 +161,7 @@ local properties = allocate {
metadata = { pdf = "Div", nature = "display" },
metavariable = { pdf = "Span", nature = "mixed" },
+ mid = { pdf = "Span", nature = "inline" },
sub = { pdf = "Span", nature = "inline" },
sup = { pdf = "Span", nature = "inline" },
subsup = { pdf = "Span", nature = "inline" },
diff --git a/tex/context/base/strc-tag.mkiv b/tex/context/base/strc-tag.mkiv
index b84efc92c..6563e884e 100644
--- a/tex/context/base/strc-tag.mkiv
+++ b/tex/context/base/strc-tag.mkiv
@@ -126,6 +126,7 @@
\def\t!ignore {ignore} % Span
+\def\t!mid {mid} % Span
\def\t!sub {sub} % Span
\def\t!sup {sup} % Span
\def\t!subsup {subsup} % Span
diff --git a/tex/context/base/supp-box.mkiv b/tex/context/base/supp-box.mkiv
index 5925c591b..dc6358202 100644
--- a/tex/context/base/supp-box.mkiv
+++ b/tex/context/base/supp-box.mkiv
@@ -75,9 +75,10 @@
%D core macros \type {\strutdepth} and alike, which are
%D values.
-\def\strutdp{\dp\strutbox}
-\def\strutht{\ht\strutbox}
-\def\strutwd{\wd\strutbox}
+\def\strutdp {\dp\strutbox}
+\def\strutht {\ht\strutbox}
+\def\strutwd {\wd\strutbox}
+\def\struthtdp{\dimexpr\ht\strutbox+\dp\strutbox\relax}
%D \macros
%D {voidbox,nextbox}
diff --git a/tex/context/base/typo-scr.mkiv b/tex/context/base/typo-scr.mkiv
index 4b4487522..1a6a80d06 100644
--- a/tex/context/base/typo-scr.mkiv
+++ b/tex/context/base/typo-scr.mkiv
@@ -19,7 +19,7 @@
%D \type {shiftup} and \type {shiftdown} that can work across paragraphs.
%D \macros
-%D {low, high, lohi, hilo}
+%D {low, high, definelow, definehigh, setuplow, setuphigh}
%D
%D Although \TEX\ is pretty well aware of super- and subscripts, its mechanism
%D is mainly tuned for math mode. The next few commands take care of script
@@ -36,69 +36,232 @@
%D space. The implementation looks a bit fuzzy, since some \type {\fontdimen}'s
%D are involved to determine the optimal placement.
-% These might become parameters: \setupscripts but we need fo come up with
-% nice keys.
+\installcorenamespace {low}
+\installcorenamespace {high}
-\def\highvfraction {0}
-\def\lowvfraction {0}
-\def\highlowvfraction{.1}
-\def\highlowhfraction{.1}
+\installcommandhandler \??low {low} \??low
+\installcommandhandler \??high {high} \??high
-\unexpanded\def\low {\typo_scripts_high_low\lower\mathsubnormal{.48}\lowvfraction \t!sub}
-\unexpanded\def\high{\typo_scripts_high_low\raise\mathsupnormal{.86}\highvfraction\t!sup}
+\setuplow [\c!style=\tx,\c!distance=\zeropoint,\c!down=.48\exheight] % historical
+\setuphigh[\c!style=\tx,\c!distance=\zeropoint,\c!up =.86\exheight] % values
-\def\typo_scripts_high_low#1#2#3#4#5#6% textscript mathscript fraction extra tag
+\appendtoks \setuevalue\currentlow {\typo_scripts_low {\currentlow }}\to \everydefinelow
+\appendtoks \setuevalue\currenthigh{\typo_scripts_high{\currenthigh}}\to \everydefinehigh
+
+\unexpanded\def\typo_scripts_low#1#2%
+ {\dontleavehmode
+ \begingroup
+ \edef\currentlow{#1}%
+ \kern\lowparameter\c!distance\relax
+ \setbox\scratchbox\hbox\bgroup
+ \lower\lowparameter\c!down\hbox\bgroup
+ \ifx\fontsize\empty
+ \ifmmode
+ \mr % no color yet
+ \else
+ \uselowstyleandcolor\c!style\c!color
+ \fi
+ \else
+ \uselowstyleandcolor\c!style\c!color
+ \fi
+ \dostarttagged\t!sub\currentlow
+ #2%
+ \dostoptagged
+ \egroup
+ \egroup
+ \ht\scratchbox\strutht
+ \dp\scratchbox\strutdp
+ \box\scratchbox
+ \endgroup}
+
+\unexpanded\def\typo_scripts_high#1#2%
{\dontleavehmode
\begingroup
- \scratchdimen\dimexpr#3\exheight+#4\exheight\relax
- \kern\highlowhfraction\exheight
- \setbox\scratchbox\hbox{#1\scratchdimen\hbox
- {\ifx\fontsize\empty\ifmmode\mr\else\tx\fi\else\tx\fi
- \dostarttagged
- #5\empty#6%
- \dostoptagged}}%
- \ht\scratchbox\strutheight
- \dp\scratchbox\strutdepth
+ \edef\currenthigh{#1}%
+ \kern\highparameter\c!distance\relax
+ \setbox\scratchbox\hbox\bgroup
+ \raise\highparameter\c!up\hbox\bgroup
+ \ifx\fontsize\empty
+ \ifmmode
+ \mr % no color yet
+ \else
+ \usehighstyleandcolor\c!style\c!color
+ \fi
+ \else
+ \usehighstyleandcolor\c!style\c!color
+ \fi
+ \dostarttagged\t!sup\currenthigh
+ #2%
+ \dostoptagged
+ \egroup
+ \egroup
+ \ht\scratchbox\strutht
+ \dp\scratchbox\strutdp
\box\scratchbox
\endgroup}
+\unexpanded\def\low {\typo_scripts_low \empty}
+\unexpanded\def\high{\typo_scripts_high\empty}
+
+%D \macros
+%D {lohi, hilo, definelohi, setuplohi}
+%D
%D You can provide an optional keyword \type {left}, in which case the super and
%D subscripts will be aligned in a way that permits placement at the left of a word
%D (which means that it will be right aligned).
%D
%D \startbuffer
-%D \lohi{aha}{ah} test \lohi{aha}{ah} test
-%D \lohi[left]{aha}{ah} test \lohi[left]{aha}{ah} test
-%D \lohi{aha}{ah} test\lohi{aha}{ah} test
-%D \lohi[left]{aha}{ah}test \lohi[left]{aha}{ah}test
+%D \lohi {aha} {ah} test \lohi {aha} {ah} test
+%D \lohi [left] {aha} {ah} test \lohi [left] {aha} {ah} test
+%D \lohi {aha} {ah} test \lohi {aha} {ah} test
+%D \lohi [left] {aha} {ah}test \lohi [left] {aha} {ah} test
%D \stopbuffer
%D
%D \typebuffer
%D \getbuffer
-\unexpanded\def\lohi{\dosingleempty\typo_scripts_lohi}
-\unexpanded\def\hilo{\dosingleempty\typo_scripts_hilo}
+\installcorenamespace {lowhigh}
+
+\installcommandhandler \??lowhigh {lowhigh} \??lowhigh
+
+\setuplowhigh
+ [\c!style=\tx,
+ \c!distance=.1\exheight, % these are
+ \c!up=.96\exheight, % historical
+ \c!down=.58\exheight] % values
-\def\typo_scripts_lohi[#1]#2#3%
+\appendtoks
+ \setuevalue\currentlowhigh{\typo_scripts_lowhigh{\currentlowhigh}\typo_scripts_lowhigh_indeed}%
+\to \everydefinelowhigh
+
+\unexpanded\def\typo_scripts_lowhigh#1% #2
{\dontleavehmode
- \hbox
- {\dostarttagged\t!subsup\empty
- \setbox4\hbox{\typo_scripts_high_low\lower\mathsubnormal{.48}\highlowvfraction\t!sub{#2}}%
- \setbox6\hbox{\typo_scripts_high_low\raise\mathsupnormal{.86}\highlowvfraction\t!sup{#3}}%
- \doif{#1}{\v!left}
- {\ifdim\wd4<\wd6
- \setbox4\hbox to \wd6{\hss\box4}%
- \else
- \setbox6\hbox to \wd4{\hss\box6}%
- \fi}%
- \ifdim\wd4<\wd6
- \wd4=\zeropoint\box4\box6
+ \hbox\bgroup
+ \edef\currentlowhigh{#1}%
+ \dosingleempty} % #2
+
+\unexpanded\def\typo_scripts_lowhigh_indeed[#1]#2#3%
+ {\dostarttagged\t!subsup\currentlowhigh
+ \setbox\plusfour\hbox{\typo_scripts_lowhigh_low_high\lower\c!down\t!sub{#2}}%
+ \setbox\plussix \hbox{\typo_scripts_lowhigh_low_high\raise\c!up \t!sup{#3}}%
+ \doif{#1}{\v!left}
+ {\ifdim\wd\plusfour<\wd\plussix
+ \setbox\plusfour\hbox to \wd\plussix {\hss\box\plusfour}%
\else
- \wd6=\zeropoint\box6\box4
- \fi
- \dostoptagged}}
+ \setbox\plussix \hbox to \wd\plusfour{\hss\box\plussix }%
+ \fi}%
+ \ifdim\wd\plusfour<\wd\plussix
+ \wd\plusfour\zeropoint
+ \box\plusfour
+ \box\plussix
+ \else
+ \wd\plussix\zeropoint
+ \box\plussix
+ \box\plusfour
+ \fi
+ \dostoptagged
+ \egroup}
+
+\def\typo_scripts_lowhigh_low_high#1#2#3#4%
+ {\dontleavehmode
+ \begingroup
+ \kern\lowhighparameter\c!distance\relax
+ \setbox\scratchbox\hbox\bgroup
+ #1\lowhighparameter#2\hbox\bgroup
+ \ifx\fontsize\empty
+ \ifmmode
+ \mr % no color yet
+ \else
+ \uselowhighstyleandcolor\c!style\c!color
+ \fi
+ \else
+ \uselowhighstyleandcolor\c!style\c!color
+ \fi
+ \dostarttagged#3\empty
+ #4%
+ \dostoptagged
+ \egroup
+ \egroup
+ \ht\scratchbox\strutht
+ \dp\scratchbox\strutdp
+ \box\scratchbox
+ \endgroup}
+
+\unexpanded\def\typo_scripts_highlow_indeed[#1]#2#3%
+ {\typo_scripts_lowhigh_indeed[#1]{#3}{#2}}
+
+\unexpanded\def\lohi{\typo_scripts_lowhigh\empty\typo_scripts_lowhigh_indeed}
+\unexpanded\def\hilo{\typo_scripts_lowhigh\empty\typo_scripts_highlow_indeed}
+
+%D \macros
+%D {lowmidhigh, definelowmidhigh, setuplowmidhigh}
+%D
+%D The previous command originally didn't have definers. These were introduced when
+%D the next showed up:
+%D
+%D \startbuffer
+%D \definelow [MyLow] [style=\txx]
+%D \definehigh [MyHigh] [style=\txx]
+%D \definelowhigh [MyLoHi] [style=\txx]
+%D \definelowmidhigh[MyLoMiHi][style=\txx]
+%D
+%D We have
+%D \ruledhbox{\low {L}} and \ruledhbox{\MyLow {L}} and
+%D \ruledhbox{\high {H}} and \ruledhbox{\MyHigh {H}} and
+%D \ruledhbox{\lohi {L}{H}} and \ruledhbox{\MyLoHi {L}{H}} and
+%D \ruledhbox{\lomihi{L}{M}{H}} and \ruledhbox{\MyLoMiHi{L}{M}{H}}.
+%D \stopbuffer
+%D
+%D \typebuffer \getbuffer
+
+\installcorenamespace {lowmidhigh}
+
+\installcommandhandler \??lowmidhigh {lowmidhigh} \??lowmidhigh
+
+\setuplowmidhigh
+ [\c!style=\tx,
+ \c!up=.8\struthtdp,
+ \c!down=.8\struthtdp]
+
+\appendtoks
+ \setuevalue\currentlowmidhigh{\typo_scripts_lowmidhigh{\currentlowmidhigh}}%
+\to \everydefinelowmidhigh
+
+\unexpanded\def\typo_scripts_lowmidhigh#1#2#3#4%
+ {\dontleavehmode \hbox \bgroup
+ \edef\currentlowmidhigh{#1}%
+ \dostarttagged\t!subsup\currentlowmidhigh
+ \uselowmidhighstyleandcolor\c!style\c!color
+ \setstrut
+ \setbox\plustwo \hbox{\strut\dostarttagged\t!sub\empty#2\dostoptagged}%
+ \setbox\plusfour\hbox{\strut\dostarttagged\t!mid\empty#3\dostoptagged}% inefficient
+ \setbox\plussix \hbox{\strut\dostarttagged\t!sup\empty#4\dostoptagged}%
+ \scratchdimen \wd
+ \ifdim\wd\plustwo>\wd\plusfour
+ \ifdim\wd\plustwo>\wd\plussix
+ \plustwo
+ \else
+ \plussix
+ \fi
+ \else
+ \ifdim\wd\plusfour>\wd\plussix
+ \plusfour
+ \else
+ \plussix
+ \fi
+ \fi
+ \relax
+ \setbox\plustwo \hbox to \scratchdimen{\hss \box\plustwo \hss}%
+ \setbox\plusfour\hbox to \scratchdimen{\hss\raise\lowmidhighparameter\c!up \box\plusfour\hss}%
+ \setbox\plussix \hbox to \scratchdimen{\hss\lower\lowmidhighparameter\c!down\box\plussix \hss}%
+ \wd\plustwo \zeropoint
+ \wd\plusfour\zeropoint
+ \box\plusfour
+ \box\plustwo
+ \box\plussix
+ \dostoptagged
+ \egroup}
-\def\typo_scripts_hilo[#1]#2#3%
- {\typo_scripts_lohi[#1]{#3}{#2}}
+\unexpanded\def\lomihi{\typo_scripts_lowmidhigh\empty}
\protect \endinput
diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua
index 4e9816bd8..fb1bba060 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 : 08/10/12 00:32:43
+-- merge date : 08/10/12 19:40:14
do -- begin closure to overcome local limits and interference
@@ -1121,6 +1121,23 @@ local lpeg = require("lpeg")
local report = texio and texio.write_nl or print
+-- Watch this: Lua does some juggling with replacement values and although lpeg itself is agnostic of
+-- % characters, the replacement isn't. Now, in all of the context sources these are only a few cases
+-- where capture replacement instring happens. Interesting is that the string parsing already happens
+-- when the lpeg is made, but nevertheless is a not that useful (at least for me) feature that has the
+-- side effect that one always has to do %% in order to get a %. Okay, now that I know it is there, I
+-- might use it more often.
+--
+-- local p = P("@") / "%"
+-- lpeg.print(p) print(lpeg.match(p,"@"))
+--
+-- local p = P("@") / "%%"
+-- lpeg.print(p) print(lpeg.match(p,"@"))
+--
+-- local p = C("@") * C("!") / "%2%1"
+-- lpeg.print(p) print(lpeg.match(p,"@!"))
+
+
-- local lpmatch = lpeg.match
-- local lpprint = lpeg.print
-- local lpp = lpeg.P
@@ -1156,7 +1173,7 @@ local report = texio and texio.write_nl or print
-- function lpeg.Carg (l) local p = lpcarg(l) report("LPEG Carg =") lpprint(l) return p end
local type = type
-local byte, char, gmatch = string.byte, string.char, string.gmatch
+local byte, char, gmatch, format = string.byte, string.char, string.gmatch, string.format
-- Beware, we predefine a bunch of patterns here and one reason for doing so
-- is that we get consistent behaviour in some of the visualizers.
@@ -1873,6 +1890,16 @@ end
-- utfchar(0x205F), -- math thinspace
-- } )
+-- handy from within tex:
+
+local lpegmatch = lpeg.match
+
+local replacer = lpeg.replacer("@","%%") -- Watch the escaped % in lpeg!
+
+function string.tformat(fmt,...)
+ return format(lpegmatch(replacer,fmt),...)
+end
+
end -- closure
do -- begin closure to overcome local limits and interference