summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2014-05-17 23:46:00 +0200
committerHans Hagen <pragma@wxs.nl>2014-05-17 23:46:00 +0200
commit911a6faee70e0fce32c22bd40bcec9f9ed425615 (patch)
tree8ba97c2e66f121f9ff51355288abddf459dcb8d3
parentdcafc5c897cc956f197a54f516472954036af7f9 (diff)
downloadcontext-911a6faee70e0fce32c22bd40bcec9f9ed425615.tar.gz
beta 2014.05.17 23:46
-rw-r--r--scripts/context/lua/mtx-plain.lua6
-rw-r--r--tex/context/base/cont-new.mkiv2
-rw-r--r--tex/context/base/context-version.pdfbin4061 -> 4062 bytes
-rw-r--r--tex/context/base/context.mkiv2
-rw-r--r--tex/context/base/publ-dat.lua57
-rw-r--r--tex/context/base/publ-imp-cite.mkiv16
-rw-r--r--tex/context/base/publ-ini.lua136
-rw-r--r--tex/context/base/publ-ini.mkiv46
-rw-r--r--tex/context/base/status-files.pdfbin24620 -> 24618 bytes
-rw-r--r--tex/context/base/status-lua.pdfbin243695 -> 243725 bytes
-rw-r--r--tex/generic/context/luatex/luatex-basics-gen.lua13
-rw-r--r--tex/generic/context/luatex/luatex-fonts-merged.lua11
-rw-r--r--tex/generic/context/luatex/luatex-math.tex76
-rw-r--r--tex/generic/context/luatex/luatex-test.tex26
14 files changed, 285 insertions, 106 deletions
diff --git a/scripts/context/lua/mtx-plain.lua b/scripts/context/lua/mtx-plain.lua
index de13717d3..1076572fc 100644
--- a/scripts/context/lua/mtx-plain.lua
+++ b/scripts/context/lua/mtx-plain.lua
@@ -103,7 +103,11 @@ function scripts.plain.make(texengine,texformat)
end
function scripts.plain.run(texengine,texformat,filename)
- execute('%s --fmt=%s "%s"',texengine,file.removesuffix(texformat),filename)
+ local t = { }
+ for k, v in next, environment.arguments do
+ t[#t+1] = string.format("--mtx:%s=%s",k,v)
+ end
+ execute('%s --fmt=%s %s "%s"',texengine,file.removesuffix(texformat),table.concat(t," "),filename)
end
function scripts.plain.fonts()
diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv
index 47289ebe9..cded7454f 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{2014.05.16 20:08}
+\newcontextversion{2014.05.17 23:46}
%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
index 145596d8c..2b973ae9b 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.mkiv b/tex/context/base/context.mkiv
index 50a8e6259..ef3c639e3 100644
--- a/tex/context/base/context.mkiv
+++ b/tex/context/base/context.mkiv
@@ -28,7 +28,7 @@
%D up and the dependencies are more consistent.
\edef\contextformat {\jobname}
-\edef\contextversion{2014.05.16 20:08}
+\edef\contextversion{2014.05.17 23:46}
\edef\contextkind {beta}
%D For those who want to use this:
diff --git a/tex/context/base/publ-dat.lua b/tex/context/base/publ-dat.lua
index b463064ca..da2fe1f6c 100644
--- a/tex/context/base/publ-dat.lua
+++ b/tex/context/base/publ-dat.lua
@@ -24,8 +24,9 @@ end
local chardata = characters.data
local lowercase = characters.lower
-local lower, gsub, concat = string.lower, string.gsub, table.concat
-local next, type = next, type
+local lower, gsub, find = string.lower, string.gsub, string.find
+local concat = table.concat
+local next, type, rawget = next, type, rawget
local utfchar = utf.char
local lpegmatch, lpegpatterns = lpeg.match, lpeg.patterns
local textoutf = characters and characters.tex.toutf
@@ -73,13 +74,56 @@ local defaultshortcuts = {
dec = "12",
}
+local l_splitter = lpeg.tsplitat("+")
+local d_splitter = lpeg.splitat ("+")
+
function publications.new(name)
publicationsstats.nofdatasets = publicationsstats.nofdatasets + 1
+ local function getcombinedluadata(t,k)
+ if find(k,"%+") then
+ local tags = lpegmatch(l_splitter,k)
+ local parent = tags[i]
+ local first = rawget(t,parent)
+ if first then
+ local combined = first.combined
+ if not combined then
+ combined = { }
+ first.combined = combined
+ end
+ -- add new ones but only once
+ for i=1,#tags do
+ local tag = tags[i]
+ local new = true
+ for j=1,#combined do
+ if combined[j] == tag then
+ new = false
+ end
+ end
+ if new then
+ local entry = rawget(t,tag)
+ if entry then
+ combined[#combined+1] = tag
+ entry.combined[parent] = true
+ end
+ end
+ end
+ return first
+ end
+ end
+ end
+ local function getcombineddetails(t,k)
+ if find(k,"%+") then
+ local tag = lpegmatch(d_splitter,k)
+ return rawget(t,tag)
+ end
+ end
+ local luadata = setmetatableindex({ },getcombinedluadata)
+ local details = setmetatableindex({ },getcombineddetails)
local dataset = {
name = name or "dataset " .. publicationsstats.nofdatasets,
nofentries = 0,
shortcuts = { },
- luadata = { },
+ luadata = luadata,
xmldata = xmlconvert(xmlplaceholder),
-- details = { },
nofbytes = 0,
@@ -95,10 +139,13 @@ function publications.new(name)
userdata = false,
},
}
+ -- we delay details till we need it (maybe we just delay the
+ -- individual fields but that is tricky as there can be some
+ -- depedencies)
setmetatableindex(dataset,function(t,k)
-- will become a plugin
if k == "details" and publications.enhance then
- dataset.details = { }
+ dataset.details = details
publications.enhance(dataset.name)
return dataset.details
end
@@ -150,7 +197,7 @@ local filter_2 = Cs(
)
-- Currently we expand shortcuts and for large ones (like the acknowledgements
--- in tugboat.bib this is not that efficient. However, eventually strings get
+-- in tugboat.bib) this is not that efficient. However, eventually strings get
-- hashed again.
local function do_shortcut(key,value,dataset)
diff --git a/tex/context/base/publ-imp-cite.mkiv b/tex/context/base/publ-imp-cite.mkiv
index 3d227d736..0f0c69fa7 100644
--- a/tex/context/base/publ-imp-cite.mkiv
+++ b/tex/context/base/publ-imp-cite.mkiv
@@ -146,17 +146,25 @@
% author lists: can be less
+\startsetups \s!btx:\s!cite:common:author
+ \ifx\currentbtxcitevariant\v!normal
+ \currentbtxfirst
+ \else
+ \currentbtxciteauthor
+ \fi
+\stopsetups
+
\startsetups \s!btx:\s!cite:render:author
- \directsetup{\s!btx:\s!cite:common:normal}
+ \directsetup{\s!btx:\s!cite:common:author}
\stopsetups
\startsetups \s!btx:\s!cite:render:authoryear
- \directsetup{\s!btx:\s!cite:common:normal}
+ \directsetup{\s!btx:\s!cite:common:author}
\stopsetups
\startsetups \s!btx:\s!cite:render:authoryears
- \directsetup{\s!btx:\s!cite:common:normal}
+ \directsetup{\s!btx:\s!cite:common:author}
\stopsetups
\startsetups \s!btx:\s!cite:render:authornum
- \directsetup{\s!btx:\s!cite:common:normal}
+ \directsetup{\s!btx:\s!cite:common:author}
\stopsetups
\startsetups \s!btx:\s!cite:author:num
diff --git a/tex/context/base/publ-ini.lua b/tex/context/base/publ-ini.lua
index ea54a4add..09f4b0e11 100644
--- a/tex/context/base/publ-ini.lua
+++ b/tex/context/base/publ-ini.lua
@@ -79,7 +79,7 @@ local v_left = variables.left
local v_right = variables.right
local v_middle = variables.middle
local v_inbetween = variables.inbetween
-
+local v_yes = variables.yes
local v_short = variables.short
local v_cite = variables.cite
local v_default = variables.default
@@ -121,6 +121,7 @@ local ctx_btxsetreference = context.btxsetreference
local ctx_directsetup = context.directsetup
local ctx_btxmissing = context.btxmissing
+local ctx_btxsettag = context.btxsettag
local ctx_btxcitesetup = context.btxcitesetup
local ctx_btxsetfirst = context.btxsetfirst
local ctx_btxsetsecond = context.btxsetsecond
@@ -386,30 +387,44 @@ end)
-- end
-- end
+local reported = { }
+
local function findallused(dataset,reference,block,section)
- local tags = settings_to_array(reference)
- local todo = { }
- local okay = { } -- only if mark
- local set = usedentries[dataset]
+ local tags = settings_to_array(reference)
+ local todo = { }
+ local okay = { } -- only if mark
+ local set = usedentries[dataset]
+ local valid = datasets[dataset].luadata
if set then
for i=1,#tags do
local tag = tags[i]
- local entry = set[tag]
- if entry then
- -- only once in a list
- if #entry == 1 then
- entry = entry[1]
- else
- -- find best match
- entry = entry[1] -- for now
+ if valid[tag] then
+ local entry = set[tag]
+ if entry then
+ -- only once in a list
+ if #entry == 1 then
+ entry = entry[1]
+ else
+ -- find best match (todo)
+ entry = entry[1] -- for now
+ end
+ okay[#okay+1] = entry
end
- okay[#okay+1] = entry
+ todo[tag] = true
+ elseif not reported[tag] then
+ reported[tag] = true
+ report_cite("non-existent entry %a in %a",tag,dataset)
end
- todo[tag] = true
end
else
for i=1,#tags do
- todo[tags[i]] = true
+ local tag = tags[i]
+ if valid[tag] then
+ todo[tag] = true
+ elseif not reported[tag] then
+ reported[tag] = true
+ report_cite("non-existent entry %a in %a",tag,dataset)
+ end
end
end
return okay, todo, tags
@@ -1002,6 +1017,7 @@ function lists.flushentries(dataset,sortvariant)
end
for i=1,#list do
ctx_setvalue("currentbtxindex",i)
+ -- todo: also flush combinations
ctx_btxhandlelistentry(list[i][1]) -- we can pass i here too ... more efficient to avoid the setvalue
end
end
@@ -1010,6 +1026,7 @@ function lists.fetchentries(dataset)
local list = renderings[dataset].list
for i=1,#list do
ctx_setvalue("currentbtxindex",i)
+ -- todo: what to do with combinations
ctx_btxchecklistentry(list[i][1])
end
end
@@ -1123,14 +1140,17 @@ end
local prefixsplitter = lpeg.splitat("::")
--- function commands.btxhandlecite(dataset,tag,mark,variant,sorttype,compress)
function commands.btxhandlecite(specification)
- local dataset = specification.dataset
- local tag = specification.reference
+ local tag = specification.reference
+ if not tag or tag == "" then
+ return
+ end
+ --
+ local dataset = specification.dataset or ""
local mark = specification.markentry ~= false
- local variant = specification.variant
+ local variant = specification.variant or "num"
local sorttype = specification.sorttype
- local compress = specification.compress
+ local compress = specification.compress == v_yes
--
local prefix, rest = lpegmatch(prefixsplitter,tag)
if rest then
@@ -1138,42 +1158,47 @@ function commands.btxhandlecite(specification)
else
rest = tag
end
- local action = citevariants[variant]
- if action then
- if trace_cite then
- report_cite("inject, dataset: %s, tag: %s, variant: %s, compressed",dataset or "-",rest,variant)
- end
- ctx_setvalue("currentbtxdataset",dataset)
- action(dataset,rest,mark ~= false,compress,variant)
+ local action = citevariants[variant] -- there is always fallback on default
+ if trace_cite then
+ report_cite("inject, dataset: %s, tag: %s, variant: %s, compressed",dataset or "-",rest,variant)
end
+ ctx_setvalue("currentbtxdataset",dataset)
+ action(dataset,rest,mark,compress,variant)
end
-function commands.btxhandlenocite(dataset,tag,mark)
- if mark ~= false then
- local prefix, rest = lpegmatch(prefixsplitter,tag)
- if rest then
- dataset = prefix
- else
- rest = tag
- end
- ctx_setvalue("currentbtxdataset",dataset)
- local tags = settings_to_array(rest)
- if trace_cite then
- report_cite("mark, dataset: %s, tags: % | t",dataset or "-",tags)
- end
- for i=1,#tags do
- markcite(dataset,tags[i])
- end
+function commands.btxhandlenocite(specification)
+ local mark = specification.markentry ~= false
+ if not mark then
+ return
end
-end
-
-function commands.btxcitevariant(dataset,block,tags,variant)
- local action = citevariants[variant]
- if action then
- action(dataset,tags,variant)
+ local tag = specification.reference
+ if not tag or tag == "" then
+ return
+ end
+ local dataset = specification.dataset or ""
+ local prefix, rest = lpegmatch(prefixsplitter,tag)
+ if rest then
+ dataset = prefix
+ else
+ rest = tag
+ end
+ ctx_setvalue("currentbtxdataset",dataset)
+ local tags = settings_to_array(rest)
+ if trace_cite then
+ report_cite("mark, dataset: %s, tags: % | t",dataset or "-",tags)
+ end
+ for i=1,#tags do
+ markcite(dataset,tags[i])
end
end
+-- function commands.btxcitevariant(dataset,block,tags,variant) -- uses? specification ?
+-- local action = citevariants[variant]
+-- if action then
+-- action(dataset,tags,variant)
+-- end
+-- end
+
-- sorter
local keysorter = function(a,b) return a.sortkey < b.sortkey end
@@ -1267,14 +1292,15 @@ local function processcite(dataset,reference,mark,compress,setup,getter,setter,c
local entry = target[i]
local first = entry.first
if first then
+ local tags = entry.tags
if mark then
- local tags = entry.tags
for i=1,#tags do
local tag = tags[i]
markcite(dataset,tag)
todo[tag] = false
end
end
+ ctx_btxsettag(tags[1])
local internal = first.internal
if internal then
ctx_btxsetinternal(internal)
@@ -1283,11 +1309,12 @@ local function processcite(dataset,reference,mark,compress,setup,getter,setter,c
ctx_btxsetfirst(f_missing(first.tag))
end
else
+ local tag = entry.tag
if mark then
- local tag = entry.tag
markcite(dataset,tag)
todo[tag] = false
end
+ ctx_btxsettag(tag)
local internal = entry.internal
if internal then
ctx_btxsetinternal(internal)
@@ -1308,6 +1335,7 @@ local function processcite(dataset,reference,mark,compress,setup,getter,setter,c
markcite(dataset,tag)
todo[tag] = false
end
+ ctx_btxsettag(tag)
local internal = entry.internal
if internal then
ctx_btxsetinternal(internal)
@@ -1650,7 +1678,7 @@ local function setter(dataset,tag,entry,internal)
internal = internal,
author = getfield(dataset,tag,"author"),
num = text,
- sortkey = lpegmatch(numberonly,text)
+ sortkey = text and lpegmatch(numberonly,text)
}
end
@@ -1676,7 +1704,7 @@ local function setter(dataset,tag,entry,internal)
internal = internal,
author = getfield(dataset,tag,"author"),
year = year,
- sortkey = lpegmatch(numberonly,year)
+ sortkey = year and lpegmatch(numberonly,year)
}
end
diff --git a/tex/context/base/publ-ini.mkiv b/tex/context/base/publ-ini.mkiv
index ab20d2fd9..0b1a92300 100644
--- a/tex/context/base/publ-ini.mkiv
+++ b/tex/context/base/publ-ini.mkiv
@@ -554,6 +554,13 @@
\unexpanded\def\btxflushauthorinverted {\btx_flush_author{inverted}} % #1
\unexpanded\def\btxflushauthorinvertedshort{\btx_flush_author{invertedshort}} % #1
+\unexpanded\def\currentbtxciteauthor % always author
+ {\ctxcommand{btxauthor("\currentbtxdataset","\currentbtxtag","author",{
+ combiner = "\btxcitevariantparameter\c!author",
+ etallimit = \number\btxcitevariantparameter\c!etallimit,
+ etaldisplay = \number\btxcitevariantparameter\c!etaldisplay,
+ })}}
+
% \btxflushauthor{author}
% \btxflushauthor{artauthor}
% \btxflushauthor{editor}
@@ -713,11 +720,15 @@
\unexpanded\def\publ_cite_tags_options[#1]%
{\strictdoifnextoptionalelse{\publ_cite_tags_options_indeed{#1}}{\publ_cite_tags_indeed{#1}}}
+% \unexpanded\def\publ_cite_tags_options_indeed#1[#2]%
+% {\edef\currentbtxcitetag{#2}%
+% \doifassignmentelse{#1}
+% {\publ_cite_tags_settings_indeed{#1}}
+% {\publ_cite_tags_variants_indeed{#1}}}
+
\unexpanded\def\publ_cite_tags_options_indeed#1[#2]%
{\edef\currentbtxcitetag{#2}%
- \doifassignmentelse{#1}
- {\publ_cite_tags_settings_indeed{#1}}
- {\publ_cite_tags_variants_indeed{#1}}}
+ \doifassignmentelse{#1}\publ_cite_tags_settings_indeed\publ_cite_tags_variants_indeed{#1}}
\def\publ_cite_tags_settings_indeed#1%
{\letinteractionparameter\c!style\empty
@@ -778,22 +789,14 @@
{\usebtxcitevariantstyleandcolor\c!style\c!color
\letbtxcitevariantparameter\c!alternative\currentbtxcitevariant
\btxcitevariantparameter\v!left
- \edef\p_compress{\btxcitevariantparameter\c!compress}%
-% \ctxcommand{btxhandlecite(%
-% "\currentbtxdataset",%
-% "#1",%
-% \iftrialtypesetting false\else true\fi,%
-% "\currentbtxcitevariant",%
-% "\btxcitevariantparameter\c!sorttype",%
-% \ifx\p_compress\v!yes true\else false\fi%
-% )}%
\ctxcommand{btxhandlecite{%
dataset = "\currentbtxdataset",%
reference = "#1",%
markentry = \iftrialtypesetting false\else true\fi,%
variant = "\currentbtxcitevariant",%
sorttype = "\btxcitevariantparameter\c!sorttype",%
- compress = \ifx\p_compress\v!yes true\else false\fi,%
+ compress = "\btxcitevariantparameter\c!compress",%
+ author = "\btxcitevariantparameter\c!author",%
}}%
\btxcitevariantparameter\v!right
\endgroup}
@@ -815,7 +818,11 @@
\unexpanded\def\publ_cite_no[#1]%
{\iftrialtypesetting \else
- \ctxcommand{btxhandlenocite("\currentbtxdataset","#1",true)}%
+ \ctxcommand{btxhandlecite{%
+ dataset = "\currentbtxdataset",%
+ reference = "#1",%
+ markentry = \iftrialtypesetting false\else true\fi,%
+ }}%
\fi}
\unexpanded\def\btxmissing#1%
@@ -833,13 +840,14 @@
\newconstant\currentbtxconcat
-\unexpanded\def\btxcitevariant#1%
- {\ctxcommand{btxcitevariant("\currentbtxdataset","\currentbtxblock","\currentbtxtag","#1")}}
+% \unexpanded\def\btxcitevariant#1%
+% {\ctxcommand{btxcitevariant("\currentbtxdataset","\currentbtxblock","\currentbtxtag","#1")}}
\unexpanded\def\btxcitereset
{\let\currentbtxfirst \empty
\let\currentbtxsecond \empty
\let\currentbtxinternal\empty
+ \let\currentbtxtag \empty
\setconstant\currentbtxconcat\zerocount}
\btxcitereset
@@ -850,6 +858,7 @@
\unexpanded\def\btxsetfirst {\def\currentbtxfirst}
\unexpanded\def\btxsetsecond {\def\currentbtxsecond}
+\unexpanded\def\btxsettag {\def\currentbtxtag}
\unexpanded\def\btxsetinternal{\def\currentbtxinternal}
\unexpanded\def\btxsetconcat#1{\setconstant\currentbtxconcat#1\relax}
@@ -1066,6 +1075,11 @@
[artauthor]
[author]
+\setupbtxcitevariant
+ [\c!author =\btxlistvariantparameter\c!author,
+ \c!etallimit =\btxlistvariantparameter\c!etallimit,
+ \c!etaldisplay =\btxlistvariantparameter\c!etaldisplay]
+
% Do we want these in the format? Loading them delayed is somewhat messy.
\loadbtxdefinitionfile[apa]
diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf
index 87359fbfc..5480e6dd9 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 1206b6e33..a41068eda 100644
--- a/tex/context/base/status-lua.pdf
+++ b/tex/context/base/status-lua.pdf
Binary files differ
diff --git a/tex/generic/context/luatex/luatex-basics-gen.lua b/tex/generic/context/luatex/luatex-basics-gen.lua
index a304ab6aa..c19a49af3 100644
--- a/tex/generic/context/luatex/luatex-basics-gen.lua
+++ b/tex/generic/context/luatex/luatex-basics-gen.lua
@@ -353,3 +353,16 @@ end
function table.setmetatableindex(t,f)
setmetatable(t,{ __index = f })
end
+
+-- helper for plain:
+
+arguments = { }
+
+if arg then
+ for i=1,#arg do
+ local k, v = string.match(arg[i],"^%-%-([^=]+)=?(.-)$")
+ if k and v then
+ arguments[k] = v
+ end
+ end
+end
diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua
index 70a395d7b..f7801ea05 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/16/14 20:08:26
+-- merge date : 05/17/14 23:46:22
do -- begin closure to overcome local limits and interference
@@ -3460,6 +3460,15 @@ end
function table.setmetatableindex(t,f)
setmetatable(t,{ __index=f })
end
+arguments={}
+if arg then
+ for i=1,#arg do
+ local k,v=string.match(arg[i],"^%-%-([^=]+)=?(.-)$")
+ if k and v then
+ arguments[k]=v
+ end
+ end
+end
end -- closure
diff --git a/tex/generic/context/luatex/luatex-math.tex b/tex/generic/context/luatex/luatex-math.tex
index c8210c2b5..604b4a1f8 100644
--- a/tex/generic/context/luatex/luatex-math.tex
+++ b/tex/generic/context/luatex/luatex-math.tex
@@ -19,15 +19,6 @@
% a bunch of fonts:
-\font\tenrm = file:lmroman10-regular.otf:+liga;+kern;+tlig;+trep at 10pt
-\font\sevenrm = file:lmroman7-regular.otf:+liga;+kern;+tlig;+trep at 7pt
-\font\fiverm = file:lmroman5-regular.otf:+liga;+kern;+tlig;+trep at 5pt
-
-\font\tentt = file:lmmono10-regular.otf at 10pt
-\font\tensl = file:lmromanslant10-regular.otf:+liga;+kern;+tlig;+trep at 10pt
-\font\tenit = file:lmroman10-italic.otf:+liga;+kern;+tlig;+trep at 10pt
-\font\tenbi = file:lmroman10-bolditalic.otf:+liga;+kern;+tlig;+trep at 10pt
-
\let \teni = \relax
\let \seveni = \relax
\let \fivei = \relax
@@ -35,19 +26,58 @@
\let \sevensy = \relax
\let \fivesy = \relax
\let \tenex = \relax
-\let \tenbf = \relax
\let \sevenbf = \relax
\let \fivebf = \relax
-\tenrm
+\def\latinmodern
+ {\font\tenrm = file:lmroman10-regular.otf:+liga;+kern;+tlig;+trep at 10pt
+ \font\sevenrm = file:lmroman7-regular.otf:+liga;+kern;+tlig;+trep at 7pt
+ \font\fiverm = file:lmroman5-regular.otf:+liga;+kern;+tlig;+trep at 5pt
+ %
+ \font\tentt = file:lmmono10-regular.otf at 10pt
+ \font\tensl = file:lmromanslant10-regular.otf:+liga;+kern;+tlig;+trep at 10pt
+ \font\tenit = file:lmroman10-italic.otf:+liga;+kern;+tlig;+trep at 10pt
+ \font\tenbf = file:lmroman10-bold.otf:+liga;+kern;+tlig;+trep at 10pt
+ \font\tenbi = file:lmroman10-bolditalic.otf:+liga;+kern;+tlig;+trep at 10pt
+ %
+ \font\mathfonttextupright = file:latinmodern-math.otf:ssty=0;fixmath=yes at 10pt
+ \font\mathfontscriptupright = file:latinmodern-math.otf:ssty=1;fixmath=yes at 7pt
+ \font\mathfontscriptscriptupright = file:latinmodern-math.otf:ssty=2;fixmath=yes at 5pt
+ %
+ \textfont 0 = \mathfonttextupright
+ \scriptfont 0 = \mathfontscriptupright
+ \scriptscriptfont 0 = \mathfontscriptscriptupright
+ %
+ \tenrm}
-\font\mathfonttextupright = file:latinmodern-math.otf:ssty=0;fixmath=yes at 10pt
-\font\mathfontscriptupright = file:latinmodern-math.otf:ssty=1;fixmath=yes at 7pt
-\font\mathfontscriptscriptupright = file:latinmodern-math.otf:ssty=2;fixmath=yes at 5pt
+\def\lucidabright
+ {\font\tenrm = file:lucidabrightot.otf:+liga;+kern;+tlig;+trep at 10pt
+ \font\sevenrm = file:lucidabrightot.otf:+liga;+kern;+tlig;+trep at 7pt
+ \font\fiverm = file:lucidabrightot.otf:+liga;+kern;+tlig;+trep at 5pt
+ %
+ \font\tentt = file:lucidabrightot.otf at 10pt
+ \font\tenit = file:lucidabrightot.otf:+liga;+kern;+tlig;+trep at 10pt
+ \font\tenit = file:lucidabrightot-italic.otf:+liga;+kern;+tlig;+trep at 10pt
+ \font\tenbf = file:lucidabrightot-demi.otf:+liga;+kern;+tlig;+trep at 10pt
+ \font\tenbi = file:lucidabrightot-demiitalic.otf:+liga;+kern;+tlig;+trep at 10pt
+ %
+ \font\mathfonttextupright = file:lucidabrightmathot.otf:ssty=0;fixmath=yes at 10pt
+ \font\mathfontscriptupright = file:lucidabrightmathot.otf:ssty=1;fixmath=yes at 7pt
+ \font\mathfontscriptscriptupright = file:lucidabrightmathot.otf:ssty=2;fixmath=yes at 5pt
+ %
+ \textfont 0 = \mathfonttextupright
+ \scriptfont 0 = \mathfontscriptupright
+ \scriptscriptfont 0 = \mathfontscriptscriptupright
+ %
+ \tenrm}
-\textfont 0 = \mathfonttextupright
-\scriptfont 0 = \mathfontscriptupright
-\scriptscriptfont 0 = \mathfontscriptscriptupright
+\directlua {
+ if arguments["mtx:lucidabright"] then
+ tex.print("\string\\lucidabright")
+ else
+ tex.print("\string\\latinmodern")
+ end
+}
\newtoks\everymathrm
\newtoks\everymathmit
@@ -58,12 +88,12 @@
\newtoks\everymathbi
\newtoks\everymathtt
-\def\rm{\fam0\relax\the\everymathmrm\relax\tenrm\relax}
-\def\it{\fam0\relax\the\everymathit \relax\tenit\relax}
-\def\sl{\fam0\relax\the\everymathsl \relax\tensl\relax}
-\def\bf{\fam0\relax\the\everymathbf \relax\tenbf\relax}
-\def\bi{\fam0\relax\the\everymathbi \relax\tenbi\relax}
-\def\tt{\fam0\relax\the\everymathtt \relax\tentt\relax}
+\def\rm{\fam0\relax\the\everymathrm\relax\tenrm\relax}
+\def\it{\fam0\relax\the\everymathit\relax\tenit\relax}
+\def\sl{\fam0\relax\the\everymathsl\relax\tensl\relax}
+\def\bf{\fam0\relax\the\everymathbf\relax\tenbf\relax}
+\def\bi{\fam0\relax\the\everymathbi\relax\tenbi\relax}
+\def\tt{\fam0\relax\the\everymathtt\relax\tentt\relax}
\let\mit \relax % use names or \Uchar or define a vector
\let\cal \relax % idem, i'm not in the mood for this now
diff --git a/tex/generic/context/luatex/luatex-test.tex b/tex/generic/context/luatex/luatex-test.tex
index fbf8ce3cf..b822af668 100644
--- a/tex/generic/context/luatex/luatex-test.tex
+++ b/tex/generic/context/luatex/luatex-test.tex
@@ -84,4 +84,30 @@ $$\sqrt {2} { { {1} \over { {1} \over {x} } } } $$
\cows Hello World!
+% math test
+
+\latinmodern
+
+\def\sqrt{\Uroot "0 "221A{}}
+
+\def\root#1\of{\Uroot "0 "221A{#1}}
+
+Inline $\sqrt{x}{1.2}$ math. % same for $\root n of x$
+
+$\root3\of x$
+
+$\sin{x}$
+
+\lucidabright
+
+\def\sqrt{\Uroot "0 "221A{}}
+
+\def\root#1\of{\Uroot "0 "221A{#1}}
+
+Inline $\sqrt{x}{1.2}$ math. % same for $\root n of x$
+
+$\root3\of x$
+
+$\sin{x}$
+
\end