From 665c304e7a58811e8f6225721685bf13259f19b3 Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Mon, 23 Jul 2012 20:18:00 +0200 Subject: beta 2012.07.23 20:18 --- scripts/context/lua/mtxrun.lua | 179 ++++- scripts/context/stubs/mswin/mtxrun.lua | 179 ++++- scripts/context/stubs/unix/mtxrun | 179 ++++- tex/context/base/bibl-tra.lua | 2 +- tex/context/base/buff-par.lua | 2 +- tex/context/base/char-def.lua | 3 +- tex/context/base/char-enc.lua | 2 +- tex/context/base/char-ent.lua | 3 +- tex/context/base/char-map.lua | 1 + tex/context/base/cldf-bas.lua | 2 +- tex/context/base/cldf-int.lua | 2 +- tex/context/base/colo-icc.lua | 2 +- tex/context/base/cont-new.mkii | 2 +- tex/context/base/cont-new.mkiv | 2 +- tex/context/base/context-version.pdf | Bin 4088 -> 4078 bytes tex/context/base/context-version.png | Bin 106703 -> 106362 bytes tex/context/base/context.mkii | 2 +- tex/context/base/context.mkiv | 2 +- tex/context/base/file-res.lua | 2 +- tex/context/base/font-age.lua | 1 + tex/context/base/font-ott.lua | 2 +- tex/context/base/lang-def.lua | 3 +- tex/context/base/lang-txt.lua | 5 +- tex/context/base/lang-wrd.lua | 2 +- tex/context/base/lpdf-col.lua | 2 +- tex/context/base/luat-cod.lua | 5 +- tex/context/base/luat-env.lua | 11 +- tex/context/base/luat-sto.lua | 23 +- tex/context/base/lxml-lpt.lua | 2 +- tex/context/base/lxml-tex.lua | 2 +- tex/context/base/math-ali.mkiv | 2 +- tex/context/base/math-ini.lua | 2 +- tex/context/base/math-ini.mkiv | 1 + tex/context/base/math-ttv.lua | 799 +++++++++++++++++++++ tex/context/base/math-vfu.lua | 785 +------------------- tex/context/base/mult-aux.mkiv | 4 +- tex/context/base/mult-def.lua | 3 +- tex/context/base/mult-ini.lua | 2 +- tex/context/base/mult-mes.lua | 3 +- tex/context/base/node-dir.lua | 2 +- tex/context/base/node-ref.lua | 4 +- tex/context/base/page-ins.lua | 2 +- tex/context/base/page-mix.lua | 2 + tex/context/base/scrn-ini.lua | 2 +- tex/context/base/scrn-ref.lua | 2 +- tex/context/base/sort-lan.lua | 3 +- tex/context/base/status-files.pdf | Bin 24382 -> 24353 bytes tex/context/base/status-lua.pdf | Bin 184451 -> 184566 bytes tex/context/base/strc-reg.mkiv | 6 +- tex/context/base/strc-syn.lua | 2 +- tex/context/base/trac-tex.lua | 2 +- tex/context/base/util-lua.lua | 174 ++++- tex/context/base/x-mathml.mkiv | 17 +- tex/generic/context/luatex/luatex-fonts-merged.lua | 2 +- 54 files changed, 1544 insertions(+), 901 deletions(-) create mode 100644 tex/context/base/math-ttv.lua diff --git a/scripts/context/lua/mtxrun.lua b/scripts/context/lua/mtxrun.lua index 07bbcaa91..16c850e64 100644 --- a/scripts/context/lua/mtxrun.lua +++ b/scripts/context/lua/mtxrun.lua @@ -4722,36 +4722,178 @@ if not modules then modules = { } end modules ['util-lua'] = { version = 1.001, comment = "companion to luat-lib.mkiv", author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + comment = "the strip code is written by Peter Cawley", copyright = "PRAGMA ADE / ConTeXt Development Team", license = "see context related readme files" } -utilities = utilities or {} -utilities.lua = utilities.lua or { } -utilities.report = logs and logs.reporter("system") or print +local rep, sub, byte, dump = string.rep, string.sub, string.byte, string.dump +local loadstring, loadfile = loadstring, loadfile + +utilities = utilities or {} +utilities.lua = utilities.lua or { } +local luautilities = utilities.lua + +utilities.report = logs and logs.reporter("system") or print -local function stupidcompile(luafile,lucfile) +local tracestripping = false +local forcestupidcompile = true +luautilities.stripcode = true +luautilities.nofstrippedchunks = 0 +luautilities.nofstrippedbytes = 0 + +-- The next function was posted by Peter Cawley on the lua list and strips line +-- number information etc. from the bytecode data blob. We only apply this trick +-- when we store data tables. Stripping makes the compressed format file about +-- 1MB smaller (and uncompressed we save at least 6MB). +-- +-- You can consider this feature an experiment, so it might disappear. There is +-- no noticeable gain in runtime although the memory footprint should be somewhat +-- smaller (and the file system has a bit less to deal with). +-- +-- Begin of borrowed code ... works for Lua 5.1 which LuaTeX currently uses ... + +local function strip_code_pc(dump,name) + local before = #dump + local version, format, endian, int, size, ins, num = byte(dump,5,11) + local subint + if endian == 1 then + subint = function(dump, i, l) + local val = 0 + for n = l, 1, -1 do + val = val * 256 + byte(dump,i + n - 1) + end + return val, i + l + end + else + subint = function(dump, i, l) + local val = 0 + for n = 1, l, 1 do + val = val * 256 + byte(dump,i + n - 1) + end + return val, i + l + end + end + local strip_function + strip_function = function(dump) + local count, offset = subint(dump, 1, size) + local stripped, dirty = rep("\0", size), offset + count + offset = offset + count + int * 2 + 4 + offset = offset + int + subint(dump, offset, int) * ins + count, offset = subint(dump, offset, int) + for n = 1, count do + local t + t, offset = subint(dump, offset, 1) + if t == 1 then + offset = offset + 1 + elseif t == 4 then + offset = offset + size + subint(dump, offset, size) + elseif t == 3 then + offset = offset + num + end + end + count, offset = subint(dump, offset, int) + stripped = stripped .. sub(dump,dirty, offset - 1) + for n = 1, count do + local proto, off = strip_function(sub(dump,offset, -1)) + stripped, offset = stripped .. proto, offset + off - 1 + end + offset = offset + subint(dump, offset, int) * int + int + count, offset = subint(dump, offset, int) + for n = 1, count do + offset = offset + subint(dump, offset, size) + size + int * 2 + end + count, offset = subint(dump, offset, int) + for n = 1, count do + offset = offset + subint(dump, offset, size) + size + end + stripped = stripped .. rep("\0", int * 3) + return stripped, offset + end + dump = sub(dump,1,12) .. strip_function(sub(dump,13,-1)) + local after = #dump + local delta = before-after + if tracestripping then + utilities.report("stripped bytecode: %s, before %s, after %s, delta %s",name or "unknown",before,after,delta) + end + luautilities.nofstrippedchunks = luautilities.nofstrippedchunks + 1 + luautilities.nofstrippedbytes = luautilities.nofstrippedbytes + delta + return dump, delta +end + +-- ... end of borrowed code. + +local function strippedbytecode(code,forcestrip,name) + if forcestrip and luautilities.stripcode then + return strip_code_pc(code,name) + else + return code, 0 + end +end + +luautilities.stripbytecode = strip_code_pc +luautilities.strippedbytecode = strippedbytecode + +function luautilities.loadedluacode(fullname,forcestrip,name) + -- quite subtle ... doing this wrong incidentally can give more bytes + local code = loadfile(fullname) + if code then + code() + end + if forcestrip and luautilities.stripcode then + if type(forcestrip) == "function" then + forcestrip = forcestrip(fullname) + end + if forcestrip then + local code, n = strip_code_pc(dump(code,name or fullname)) + return loadstring(code), n + else + return code, 0 + end + else + return code, 0 + end +end + +function luautilities.strippedloadstring(str,forcestrip,name) -- better inline + if forcestrip and luautilities.stripcode then + local code, n = strip_code_pc(dump(loadstring(str)),name) + return loadstring(code), n + else + return loadstring(str) + end +end + +local function stupidcompile(luafile,lucfile,strip) local data = io.loaddata(luafile) if data and data ~= "" then - data = string.dump(data) + data = dump(loadstring(data)) + if strip then + data = strippedbytecode(data,true,luafile) -- last one is reported + end if data and data ~= "" then io.savedata(lucfile,data) end end end -function utilities.lua.compile(luafile,lucfile,cleanup,strip,fallback) -- defaults: cleanup=false strip=true +function luautilities.compile(luafile,lucfile,cleanup,strip,fallback) -- defaults: cleanup=false strip=true utilities.report("lua: compiling %s into %s",luafile,lucfile) os.remove(lucfile) - local command = "-o " .. string.quoted(lucfile) .. " " .. string.quoted(luafile) - if strip ~= false then - command = "-s " .. command + local done = false + if forcestupidcompile then + fallback = true + else + local command = "-o " .. string.quoted(lucfile) .. " " .. string.quoted(luafile) + if strip ~= false then + command = "-s " .. command + end + done = os.spawn("texluac " .. command) == 0 -- or os.spawn("luac " .. command) == 0 end - local done = os.spawn("texluac " .. command) == 0 -- or os.spawn("luac " .. command) == 0 if not done and fallback then utilities.report("lua: dumping %s into %s (unstripped)",luafile,lucfile) - stupidcompile(luafile,lucfile) -- maybe use the stripper we have elsewhere - cleanup = false -- better see how worse it is + stupidcompile(luafile,lucfile,strip) + cleanup = false -- better see how bad it is end if done and cleanup == true and lfs.isfile(lucfile) and lfs.isfile(luafile) then utilities.report("lua: removing %s",luafile) @@ -6680,6 +6822,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 loadedluacode = utilities.lua.loadedluacode -- precautions @@ -6895,13 +7038,19 @@ function environment.luafile(filename) return resolvers.findfile(filename,'luatexlibs') or "" end -environment.loadedluacode = loadfile -- can be overloaded +local function checkstrip(filename) + local modu = modules[file.nameonly(filename)] +-- if not modu then +-- print(">>>>>>>>>>>>>>>>>>>>>>>>",filename) +-- end + return modu and modu.dataonly +end function environment.luafilechunk(filename,silent) -- used for loading lua bytecode in the format filename = file.replacesuffix(filename, "lua") local fullname = environment.luafile(filename) if fullname and fullname ~= "" then - local data = environment.loadedluacode(fullname) + local data = loadedluacode(fullname,checkstrip,filename) if trace_locating then report_lua("loading file %s%s", fullname, not data and " failed" or "") elseif not silent then @@ -8206,7 +8355,7 @@ end -- of closure do -- create closure to overcome 200 locals limit -if not modules then modules = { } end modules ['lxml-pth'] = { +if not modules then modules = { } end modules ['lxml-lpt'] = { version = 1.001, comment = "this module is the basis for the lxml-* ones", author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", diff --git a/scripts/context/stubs/mswin/mtxrun.lua b/scripts/context/stubs/mswin/mtxrun.lua index 07bbcaa91..16c850e64 100644 --- a/scripts/context/stubs/mswin/mtxrun.lua +++ b/scripts/context/stubs/mswin/mtxrun.lua @@ -4722,36 +4722,178 @@ if not modules then modules = { } end modules ['util-lua'] = { version = 1.001, comment = "companion to luat-lib.mkiv", author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + comment = "the strip code is written by Peter Cawley", copyright = "PRAGMA ADE / ConTeXt Development Team", license = "see context related readme files" } -utilities = utilities or {} -utilities.lua = utilities.lua or { } -utilities.report = logs and logs.reporter("system") or print +local rep, sub, byte, dump = string.rep, string.sub, string.byte, string.dump +local loadstring, loadfile = loadstring, loadfile + +utilities = utilities or {} +utilities.lua = utilities.lua or { } +local luautilities = utilities.lua + +utilities.report = logs and logs.reporter("system") or print -local function stupidcompile(luafile,lucfile) +local tracestripping = false +local forcestupidcompile = true +luautilities.stripcode = true +luautilities.nofstrippedchunks = 0 +luautilities.nofstrippedbytes = 0 + +-- The next function was posted by Peter Cawley on the lua list and strips line +-- number information etc. from the bytecode data blob. We only apply this trick +-- when we store data tables. Stripping makes the compressed format file about +-- 1MB smaller (and uncompressed we save at least 6MB). +-- +-- You can consider this feature an experiment, so it might disappear. There is +-- no noticeable gain in runtime although the memory footprint should be somewhat +-- smaller (and the file system has a bit less to deal with). +-- +-- Begin of borrowed code ... works for Lua 5.1 which LuaTeX currently uses ... + +local function strip_code_pc(dump,name) + local before = #dump + local version, format, endian, int, size, ins, num = byte(dump,5,11) + local subint + if endian == 1 then + subint = function(dump, i, l) + local val = 0 + for n = l, 1, -1 do + val = val * 256 + byte(dump,i + n - 1) + end + return val, i + l + end + else + subint = function(dump, i, l) + local val = 0 + for n = 1, l, 1 do + val = val * 256 + byte(dump,i + n - 1) + end + return val, i + l + end + end + local strip_function + strip_function = function(dump) + local count, offset = subint(dump, 1, size) + local stripped, dirty = rep("\0", size), offset + count + offset = offset + count + int * 2 + 4 + offset = offset + int + subint(dump, offset, int) * ins + count, offset = subint(dump, offset, int) + for n = 1, count do + local t + t, offset = subint(dump, offset, 1) + if t == 1 then + offset = offset + 1 + elseif t == 4 then + offset = offset + size + subint(dump, offset, size) + elseif t == 3 then + offset = offset + num + end + end + count, offset = subint(dump, offset, int) + stripped = stripped .. sub(dump,dirty, offset - 1) + for n = 1, count do + local proto, off = strip_function(sub(dump,offset, -1)) + stripped, offset = stripped .. proto, offset + off - 1 + end + offset = offset + subint(dump, offset, int) * int + int + count, offset = subint(dump, offset, int) + for n = 1, count do + offset = offset + subint(dump, offset, size) + size + int * 2 + end + count, offset = subint(dump, offset, int) + for n = 1, count do + offset = offset + subint(dump, offset, size) + size + end + stripped = stripped .. rep("\0", int * 3) + return stripped, offset + end + dump = sub(dump,1,12) .. strip_function(sub(dump,13,-1)) + local after = #dump + local delta = before-after + if tracestripping then + utilities.report("stripped bytecode: %s, before %s, after %s, delta %s",name or "unknown",before,after,delta) + end + luautilities.nofstrippedchunks = luautilities.nofstrippedchunks + 1 + luautilities.nofstrippedbytes = luautilities.nofstrippedbytes + delta + return dump, delta +end + +-- ... end of borrowed code. + +local function strippedbytecode(code,forcestrip,name) + if forcestrip and luautilities.stripcode then + return strip_code_pc(code,name) + else + return code, 0 + end +end + +luautilities.stripbytecode = strip_code_pc +luautilities.strippedbytecode = strippedbytecode + +function luautilities.loadedluacode(fullname,forcestrip,name) + -- quite subtle ... doing this wrong incidentally can give more bytes + local code = loadfile(fullname) + if code then + code() + end + if forcestrip and luautilities.stripcode then + if type(forcestrip) == "function" then + forcestrip = forcestrip(fullname) + end + if forcestrip then + local code, n = strip_code_pc(dump(code,name or fullname)) + return loadstring(code), n + else + return code, 0 + end + else + return code, 0 + end +end + +function luautilities.strippedloadstring(str,forcestrip,name) -- better inline + if forcestrip and luautilities.stripcode then + local code, n = strip_code_pc(dump(loadstring(str)),name) + return loadstring(code), n + else + return loadstring(str) + end +end + +local function stupidcompile(luafile,lucfile,strip) local data = io.loaddata(luafile) if data and data ~= "" then - data = string.dump(data) + data = dump(loadstring(data)) + if strip then + data = strippedbytecode(data,true,luafile) -- last one is reported + end if data and data ~= "" then io.savedata(lucfile,data) end end end -function utilities.lua.compile(luafile,lucfile,cleanup,strip,fallback) -- defaults: cleanup=false strip=true +function luautilities.compile(luafile,lucfile,cleanup,strip,fallback) -- defaults: cleanup=false strip=true utilities.report("lua: compiling %s into %s",luafile,lucfile) os.remove(lucfile) - local command = "-o " .. string.quoted(lucfile) .. " " .. string.quoted(luafile) - if strip ~= false then - command = "-s " .. command + local done = false + if forcestupidcompile then + fallback = true + else + local command = "-o " .. string.quoted(lucfile) .. " " .. string.quoted(luafile) + if strip ~= false then + command = "-s " .. command + end + done = os.spawn("texluac " .. command) == 0 -- or os.spawn("luac " .. command) == 0 end - local done = os.spawn("texluac " .. command) == 0 -- or os.spawn("luac " .. command) == 0 if not done and fallback then utilities.report("lua: dumping %s into %s (unstripped)",luafile,lucfile) - stupidcompile(luafile,lucfile) -- maybe use the stripper we have elsewhere - cleanup = false -- better see how worse it is + stupidcompile(luafile,lucfile,strip) + cleanup = false -- better see how bad it is end if done and cleanup == true and lfs.isfile(lucfile) and lfs.isfile(luafile) then utilities.report("lua: removing %s",luafile) @@ -6680,6 +6822,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 loadedluacode = utilities.lua.loadedluacode -- precautions @@ -6895,13 +7038,19 @@ function environment.luafile(filename) return resolvers.findfile(filename,'luatexlibs') or "" end -environment.loadedluacode = loadfile -- can be overloaded +local function checkstrip(filename) + local modu = modules[file.nameonly(filename)] +-- if not modu then +-- print(">>>>>>>>>>>>>>>>>>>>>>>>",filename) +-- end + return modu and modu.dataonly +end function environment.luafilechunk(filename,silent) -- used for loading lua bytecode in the format filename = file.replacesuffix(filename, "lua") local fullname = environment.luafile(filename) if fullname and fullname ~= "" then - local data = environment.loadedluacode(fullname) + local data = loadedluacode(fullname,checkstrip,filename) if trace_locating then report_lua("loading file %s%s", fullname, not data and " failed" or "") elseif not silent then @@ -8206,7 +8355,7 @@ end -- of closure do -- create closure to overcome 200 locals limit -if not modules then modules = { } end modules ['lxml-pth'] = { +if not modules then modules = { } end modules ['lxml-lpt'] = { version = 1.001, comment = "this module is the basis for the lxml-* ones", author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", diff --git a/scripts/context/stubs/unix/mtxrun b/scripts/context/stubs/unix/mtxrun index 07bbcaa91..16c850e64 100755 --- a/scripts/context/stubs/unix/mtxrun +++ b/scripts/context/stubs/unix/mtxrun @@ -4722,36 +4722,178 @@ if not modules then modules = { } end modules ['util-lua'] = { version = 1.001, comment = "companion to luat-lib.mkiv", author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + comment = "the strip code is written by Peter Cawley", copyright = "PRAGMA ADE / ConTeXt Development Team", license = "see context related readme files" } -utilities = utilities or {} -utilities.lua = utilities.lua or { } -utilities.report = logs and logs.reporter("system") or print +local rep, sub, byte, dump = string.rep, string.sub, string.byte, string.dump +local loadstring, loadfile = loadstring, loadfile + +utilities = utilities or {} +utilities.lua = utilities.lua or { } +local luautilities = utilities.lua + +utilities.report = logs and logs.reporter("system") or print -local function stupidcompile(luafile,lucfile) +local tracestripping = false +local forcestupidcompile = true +luautilities.stripcode = true +luautilities.nofstrippedchunks = 0 +luautilities.nofstrippedbytes = 0 + +-- The next function was posted by Peter Cawley on the lua list and strips line +-- number information etc. from the bytecode data blob. We only apply this trick +-- when we store data tables. Stripping makes the compressed format file about +-- 1MB smaller (and uncompressed we save at least 6MB). +-- +-- You can consider this feature an experiment, so it might disappear. There is +-- no noticeable gain in runtime although the memory footprint should be somewhat +-- smaller (and the file system has a bit less to deal with). +-- +-- Begin of borrowed code ... works for Lua 5.1 which LuaTeX currently uses ... + +local function strip_code_pc(dump,name) + local before = #dump + local version, format, endian, int, size, ins, num = byte(dump,5,11) + local subint + if endian == 1 then + subint = function(dump, i, l) + local val = 0 + for n = l, 1, -1 do + val = val * 256 + byte(dump,i + n - 1) + end + return val, i + l + end + else + subint = function(dump, i, l) + local val = 0 + for n = 1, l, 1 do + val = val * 256 + byte(dump,i + n - 1) + end + return val, i + l + end + end + local strip_function + strip_function = function(dump) + local count, offset = subint(dump, 1, size) + local stripped, dirty = rep("\0", size), offset + count + offset = offset + count + int * 2 + 4 + offset = offset + int + subint(dump, offset, int) * ins + count, offset = subint(dump, offset, int) + for n = 1, count do + local t + t, offset = subint(dump, offset, 1) + if t == 1 then + offset = offset + 1 + elseif t == 4 then + offset = offset + size + subint(dump, offset, size) + elseif t == 3 then + offset = offset + num + end + end + count, offset = subint(dump, offset, int) + stripped = stripped .. sub(dump,dirty, offset - 1) + for n = 1, count do + local proto, off = strip_function(sub(dump,offset, -1)) + stripped, offset = stripped .. proto, offset + off - 1 + end + offset = offset + subint(dump, offset, int) * int + int + count, offset = subint(dump, offset, int) + for n = 1, count do + offset = offset + subint(dump, offset, size) + size + int * 2 + end + count, offset = subint(dump, offset, int) + for n = 1, count do + offset = offset + subint(dump, offset, size) + size + end + stripped = stripped .. rep("\0", int * 3) + return stripped, offset + end + dump = sub(dump,1,12) .. strip_function(sub(dump,13,-1)) + local after = #dump + local delta = before-after + if tracestripping then + utilities.report("stripped bytecode: %s, before %s, after %s, delta %s",name or "unknown",before,after,delta) + end + luautilities.nofstrippedchunks = luautilities.nofstrippedchunks + 1 + luautilities.nofstrippedbytes = luautilities.nofstrippedbytes + delta + return dump, delta +end + +-- ... end of borrowed code. + +local function strippedbytecode(code,forcestrip,name) + if forcestrip and luautilities.stripcode then + return strip_code_pc(code,name) + else + return code, 0 + end +end + +luautilities.stripbytecode = strip_code_pc +luautilities.strippedbytecode = strippedbytecode + +function luautilities.loadedluacode(fullname,forcestrip,name) + -- quite subtle ... doing this wrong incidentally can give more bytes + local code = loadfile(fullname) + if code then + code() + end + if forcestrip and luautilities.stripcode then + if type(forcestrip) == "function" then + forcestrip = forcestrip(fullname) + end + if forcestrip then + local code, n = strip_code_pc(dump(code,name or fullname)) + return loadstring(code), n + else + return code, 0 + end + else + return code, 0 + end +end + +function luautilities.strippedloadstring(str,forcestrip,name) -- better inline + if forcestrip and luautilities.stripcode then + local code, n = strip_code_pc(dump(loadstring(str)),name) + return loadstring(code), n + else + return loadstring(str) + end +end + +local function stupidcompile(luafile,lucfile,strip) local data = io.loaddata(luafile) if data and data ~= "" then - data = string.dump(data) + data = dump(loadstring(data)) + if strip then + data = strippedbytecode(data,true,luafile) -- last one is reported + end if data and data ~= "" then io.savedata(lucfile,data) end end end -function utilities.lua.compile(luafile,lucfile,cleanup,strip,fallback) -- defaults: cleanup=false strip=true +function luautilities.compile(luafile,lucfile,cleanup,strip,fallback) -- defaults: cleanup=false strip=true utilities.report("lua: compiling %s into %s",luafile,lucfile) os.remove(lucfile) - local command = "-o " .. string.quoted(lucfile) .. " " .. string.quoted(luafile) - if strip ~= false then - command = "-s " .. command + local done = false + if forcestupidcompile then + fallback = true + else + local command = "-o " .. string.quoted(lucfile) .. " " .. string.quoted(luafile) + if strip ~= false then + command = "-s " .. command + end + done = os.spawn("texluac " .. command) == 0 -- or os.spawn("luac " .. command) == 0 end - local done = os.spawn("texluac " .. command) == 0 -- or os.spawn("luac " .. command) == 0 if not done and fallback then utilities.report("lua: dumping %s into %s (unstripped)",luafile,lucfile) - stupidcompile(luafile,lucfile) -- maybe use the stripper we have elsewhere - cleanup = false -- better see how worse it is + stupidcompile(luafile,lucfile,strip) + cleanup = false -- better see how bad it is end if done and cleanup == true and lfs.isfile(lucfile) and lfs.isfile(luafile) then utilities.report("lua: removing %s",luafile) @@ -6680,6 +6822,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 loadedluacode = utilities.lua.loadedluacode -- precautions @@ -6895,13 +7038,19 @@ function environment.luafile(filename) return resolvers.findfile(filename,'luatexlibs') or "" end -environment.loadedluacode = loadfile -- can be overloaded +local function checkstrip(filename) + local modu = modules[file.nameonly(filename)] +-- if not modu then +-- print(">>>>>>>>>>>>>>>>>>>>>>>>",filename) +-- end + return modu and modu.dataonly +end function environment.luafilechunk(filename,silent) -- used for loading lua bytecode in the format filename = file.replacesuffix(filename, "lua") local fullname = environment.luafile(filename) if fullname and fullname ~= "" then - local data = environment.loadedluacode(fullname) + local data = loadedluacode(fullname,checkstrip,filename) if trace_locating then report_lua("loading file %s%s", fullname, not data and " failed" or "") elseif not silent then @@ -8206,7 +8355,7 @@ end -- of closure do -- create closure to overcome 200 locals limit -if not modules then modules = { } end modules ['lxml-pth'] = { +if not modules then modules = { } end modules ['lxml-lpt'] = { version = 1.001, comment = "this module is the basis for the lxml-* ones", author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", diff --git a/tex/context/base/bibl-tra.lua b/tex/context/base/bibl-tra.lua index 6341898ee..3436ac88c 100644 --- a/tex/context/base/bibl-tra.lua +++ b/tex/context/base/bibl-tra.lua @@ -1,4 +1,4 @@ -if not modules then modules = { } end modules ['bibl-bib'] = { +if not modules then modules = { } end modules ['bibl-tra'] = { version = 1.001, comment = "this module is the basis for the lxml-* ones", author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", diff --git a/tex/context/base/buff-par.lua b/tex/context/base/buff-par.lua index 2015b0bc0..58ae5a268 100644 --- a/tex/context/base/buff-par.lua +++ b/tex/context/base/buff-par.lua @@ -1,4 +1,4 @@ -if not modules then modules = { } end modules ['buff-ini'] = { +if not modules then modules = { } end modules ['buff-par'] = { version = 1.001, comment = "companion to buff-ini.mkiv", author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", diff --git a/tex/context/base/char-def.lua b/tex/context/base/char-def.lua index 3d111dbe2..6c73cf008 100644 --- a/tex/context/base/char-def.lua +++ b/tex/context/base/char-def.lua @@ -3,7 +3,8 @@ if not modules then modules = { } end modules ['char-def'] = { comment = "companion to char-ini.mkiv", author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files" + license = "see context related readme files", + dataonly = true, } --[[ diff --git a/tex/context/base/char-enc.lua b/tex/context/base/char-enc.lua index ef6805e54..19955ad84 100644 --- a/tex/context/base/char-enc.lua +++ b/tex/context/base/char-enc.lua @@ -1,4 +1,4 @@ -if not modules then modules = { } end modules ['char-syn'] = { +if not modules then modules = { } end modules ['char-enc'] = { version = 1.001, comment = "companion to char-ini.mkiv", author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", diff --git a/tex/context/base/char-ent.lua b/tex/context/base/char-ent.lua index d2ac22bbf..65dbdf992 100644 --- a/tex/context/base/char-ent.lua +++ b/tex/context/base/char-ent.lua @@ -1,8 +1,9 @@ -if not modules then modules = { } end modules ['math-ent'] = { +if not modules then modules = { } end modules ['char-ent'] = { version = 1.001, comment = "companion to math-ini.mkiv", author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", copyright = "derived from the mathml 2.0 specification", + dataonly = true, } -- http://www.w3.org/2003/entities/2007/w3centities-f.ent diff --git a/tex/context/base/char-map.lua b/tex/context/base/char-map.lua index 376ebf343..93a307a97 100644 --- a/tex/context/base/char-map.lua +++ b/tex/context/base/char-map.lua @@ -4,6 +4,7 @@ if not modules then modules = { } end modules ['char-map'] = { author = "Hans Hagen & Arthur Reutenauer", copyright = "PRAGMA ADE / ConTeXt Development Team", license = "see context related readme files" + dataonly = true, } -- not yet used diff --git a/tex/context/base/cldf-bas.lua b/tex/context/base/cldf-bas.lua index 30a9265bc..a9d72630a 100644 --- a/tex/context/base/cldf-bas.lua +++ b/tex/context/base/cldf-bas.lua @@ -1,4 +1,4 @@ -if not modules then modules = { } end modules ['cldf-ini'] = { +if not modules then modules = { } end modules ['cldf-bas'] = { version = 1.001, comment = "companion to cldf-ini.mkiv", author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", diff --git a/tex/context/base/cldf-int.lua b/tex/context/base/cldf-int.lua index 55db9fa0b..b554dabc7 100644 --- a/tex/context/base/cldf-int.lua +++ b/tex/context/base/cldf-int.lua @@ -1,4 +1,4 @@ -if not modules then modules = { } end modules ['mult-clm'] = { +if not modules then modules = { } end modules ['cldf-int'] = { version = 1.001, comment = "companion to mult-clm.mkiv", author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", diff --git a/tex/context/base/colo-icc.lua b/tex/context/base/colo-icc.lua index 904d42143..4ab28eb68 100644 --- a/tex/context/base/colo-icc.lua +++ b/tex/context/base/colo-icc.lua @@ -1,4 +1,4 @@ -if not modules then modules = { } end modules ['colo-ini'] = { +if not modules then modules = { } end modules ['colo-icc'] = { version = 1.000, comment = "companion to colo-ini.mkiv", author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", diff --git a/tex/context/base/cont-new.mkii b/tex/context/base/cont-new.mkii index a21536137..650d129cd 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.07.21 16:50} +\newcontextversion{2012.07.23 20:18} %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 dcce901fb..6af5aff9c 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.07.21 16:50} +\newcontextversion{2012.07.23 20:18} %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 28e03a7a8..98526f426 100644 Binary files a/tex/context/base/context-version.pdf and b/tex/context/base/context-version.pdf differ diff --git a/tex/context/base/context-version.png b/tex/context/base/context-version.png index 3a1956d13..09cb78f21 100644 Binary files a/tex/context/base/context-version.png and b/tex/context/base/context-version.png differ diff --git a/tex/context/base/context.mkii b/tex/context/base/context.mkii index 465eeda2e..0fecb78a5 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.07.21 16:50} +\edef\contextversion{2012.07.23 20:18} %D For those who want to use this: diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv index 8ce562746..6756fb304 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.07.21 16:50} +\edef\contextversion{2012.07.23 20:18} %D For those who want to use this: diff --git a/tex/context/base/file-res.lua b/tex/context/base/file-res.lua index 4676eec92..6726f71ee 100644 --- a/tex/context/base/file-res.lua +++ b/tex/context/base/file-res.lua @@ -1,4 +1,4 @@ -if not modules then modules = { } end modules ['supp-fil'] = { +if not modules then modules = { } end modules ['file-res'] = { version = 1.001, comment = "companion to supp-fil.mkiv", author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", diff --git a/tex/context/base/font-age.lua b/tex/context/base/font-age.lua index 741bb475a..36647c3a6 100644 --- a/tex/context/base/font-age.lua +++ b/tex/context/base/font-age.lua @@ -4,6 +4,7 @@ if not modules then modules = { } end modules ['font-age'] = { author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", copyright = "derived from http://www.adobe.com/devnet/opentype/archives/glyphlist.txt", original = "Adobe Glyph List, version 2.0, September 20, 2002", + dataonly = true, } if context then diff --git a/tex/context/base/font-ott.lua b/tex/context/base/font-ott.lua index 1e4bd69af..1e0124ac5 100644 --- a/tex/context/base/font-ott.lua +++ b/tex/context/base/font-ott.lua @@ -1,4 +1,4 @@ -if not modules then modules = { } end modules ['font-otf'] = { +if not modules then modules = { } end modules ['font-ott'] = { version = 1.001, comment = "companion to font-otf.lua (tables)", author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", diff --git a/tex/context/base/lang-def.lua b/tex/context/base/lang-def.lua index 80ff13beb..8fcd7a621 100644 --- a/tex/context/base/lang-def.lua +++ b/tex/context/base/lang-def.lua @@ -1,9 +1,10 @@ -if not modules then modules = { } end modules ['lang-ini'] = { +if not modules then modules = { } end modules ['lang-def'] = { version = 1.001, comment = "companion to lang-ini.mkiv", author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", copyright = "PRAGMA ADE / ConTeXt Development Team", license = "see context related readme files" + -- dataonly = true, -- saves 10K } local lower = string.lower diff --git a/tex/context/base/lang-txt.lua b/tex/context/base/lang-txt.lua index f28cb18f1..cda3bc9e9 100644 --- a/tex/context/base/lang-txt.lua +++ b/tex/context/base/lang-txt.lua @@ -3,7 +3,8 @@ if not modules then modules = { } end modules ['lang-txt'] = { comment = "companion to lang-lab.mkiv", author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files" + license = "see context related readme files", + dataonly = true, } -- The content of this file is derived from the mkii lang-* files and @@ -1647,7 +1648,7 @@ data.labels={ nb="Del", nl="Deel ", nn="Del", - pl="Część ", + pl="Część ", pt="Parte ", ro="Partea ", ru="Часть ", diff --git a/tex/context/base/lang-wrd.lua b/tex/context/base/lang-wrd.lua index 3d3cb6aec..e23345040 100644 --- a/tex/context/base/lang-wrd.lua +++ b/tex/context/base/lang-wrd.lua @@ -1,4 +1,4 @@ -if not modules then modules = { } end modules ['lang-ini'] = { +if not modules then modules = { } end modules ['lang-wrd'] = { version = 1.001, comment = "companion to lang-ini.mkiv", author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", diff --git a/tex/context/base/lpdf-col.lua b/tex/context/base/lpdf-col.lua index 0c2a49ebe..60d02c1ff 100644 --- a/tex/context/base/lpdf-col.lua +++ b/tex/context/base/lpdf-col.lua @@ -1,4 +1,4 @@ -if not modules then modules = { } end modules ['lpdf-mis'] = { +if not modules then modules = { } end modules ['lpdf-col'] = { version = 1.001, comment = "companion to lpdf-ini.mkiv", author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", diff --git a/tex/context/base/luat-cod.lua b/tex/context/base/luat-cod.lua index 8c721aa15..6960f2811 100644 --- a/tex/context/base/luat-cod.lua +++ b/tex/context/base/luat-cod.lua @@ -39,7 +39,7 @@ function lua.registercode(filename,version) if not bytedone[barename] then local code = environment.luafilechunk(filename) if code then - assert(code)() +-- assert(code)() bytedone[barename] = true if environment.initex then local n = lua.lastbytecode + 1 @@ -98,6 +98,9 @@ if not environment.luafilechunk then end local data = loadfile(filename) texio.write("<",data and "+ " or "- ",filename,">") + if data then + data() + end return data end diff --git a/tex/context/base/luat-env.lua b/tex/context/base/luat-env.lua index 840b2344f..181e3b237 100644 --- a/tex/context/base/luat-env.lua +++ b/tex/context/base/luat-env.lua @@ -21,6 +21,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 loadedluacode = utilities.lua.loadedluacode -- precautions @@ -252,13 +253,19 @@ function environment.luafile(filename) return resolvers.findfile(filename,'luatexlibs') or "" end -environment.loadedluacode = loadfile -- can be overloaded +local function checkstrip(filename) + local modu = modules[file.nameonly(filename)] +-- if not modu then +-- print(">>>>>>>>>>>>>>>>>>>>>>>>",filename) +-- end + return modu and modu.dataonly +end function environment.luafilechunk(filename,silent) -- used for loading lua bytecode in the format filename = file.replacesuffix(filename, "lua") local fullname = environment.luafile(filename) if fullname and fullname ~= "" then - local data = environment.loadedluacode(fullname) + local data = loadedluacode(fullname,checkstrip,filename) if trace_locating then report_lua("loading file %s%s", fullname, not data and " failed" or "") elseif not silent then diff --git a/tex/context/base/luat-sto.lua b/tex/context/base/luat-sto.lua index 30a72a29b..e9d0edfe4 100644 --- a/tex/context/base/luat-sto.lua +++ b/tex/context/base/luat-sto.lua @@ -12,6 +12,7 @@ local type, next, setmetatable, getmetatable, collectgarbage = type, next, setme local gmatch, format, write_nl = string.gmatch, string.format, texio.write_nl local serialize, concat, sortedhash = table.serialize, table.concat, table.sortedhash local bytecode = lua.bytecode +local strippedloadstring = utilities.lua.strippedloadstring local trace_storage = false local report_storage = logs.reporter("system","storage") @@ -67,7 +68,8 @@ local function dump() c = c + 1 ; code[c] = format("print('restoring %s from slot %s')",message,max) end c = c + 1 ; code[c] = serialize(original,name) - bytecode[max] = loadstring(concat(code,"\n")) + -- we don't need tracing in such tables + bytecode[max] = strippedloadstring(concat(code,"\n"),true,format("slot %s",max)) collectgarbage("step") end storage.max = max @@ -108,11 +110,20 @@ statistics.register("stored bytecode data", function() local nofdumps = (storage.noftables > 0 and storage.noftables ) or storage.max-storage.min + 1 local tofmodules = storage.tofmodules or 0 local tofdumps = storage.toftables or 0 - return format("%s modules (%0.3f sec), %s tables (%0.3f sec), %s chunks (%0.3f sec)", - nofmodules, tofmodules, - nofdumps, tofdumps, - nofmodules + nofdumps, tofmodules + tofdumps - ) + if environment.initex then + return format("%s modules, %s tables, %s chunks, %s bytes stripped (%s chunks)", + nofmodules, + nofdumps, + nofmodules + nofdumps, + utilities.lua.nofstrippedbytes, utilities.lua.nofstrippedchunks + ) + else + return format("%s modules (%0.3f sec), %s tables (%0.3f sec), %s chunks (%0.3f sec)", + nofmodules, tofmodules, + nofdumps, tofdumps, + nofmodules + nofdumps, tofmodules + tofdumps + ) + end end) if lua.bytedata then diff --git a/tex/context/base/lxml-lpt.lua b/tex/context/base/lxml-lpt.lua index 44dd97155..37f07f030 100644 --- a/tex/context/base/lxml-lpt.lua +++ b/tex/context/base/lxml-lpt.lua @@ -1,4 +1,4 @@ -if not modules then modules = { } end modules ['lxml-pth'] = { +if not modules then modules = { } end modules ['lxml-lpt'] = { version = 1.001, comment = "this module is the basis for the lxml-* ones", author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", diff --git a/tex/context/base/lxml-tex.lua b/tex/context/base/lxml-tex.lua index 0b21e0a9c..7cabe22a8 100644 --- a/tex/context/base/lxml-tex.lua +++ b/tex/context/base/lxml-tex.lua @@ -1,4 +1,4 @@ -if not modules then modules = { } end modules ['lxml-tst'] = { +if not modules then modules = { } end modules ['lxml-tex'] = { version = 1.001, comment = "companion to lxml-ini.mkiv", author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", diff --git a/tex/context/base/math-ali.mkiv b/tex/context/base/math-ali.mkiv index f1d4fca30..9e6fda074 100644 --- a/tex/context/base/math-ali.mkiv +++ b/tex/context/base/math-ali.mkiv @@ -98,7 +98,7 @@ \the\mathdisplayaligntweaks \tabskip\centering} -\def\math_both_eqalign_no#1#2% +\def\math_both_eqalign_no_normal#1#2% {\ifmmode \the\mathdisplayaligntweaks % \let\strc_formulas_place_number\relax % strange hack \vcenter\bgroup diff --git a/tex/context/base/math-ini.lua b/tex/context/base/math-ini.lua index 1537d3727..f96c4d091 100644 --- a/tex/context/base/math-ini.lua +++ b/tex/context/base/math-ini.lua @@ -1,4 +1,4 @@ -if not modules then modules = { } end modules ['math-ext'] = { +if not modules then modules = { } end modules ['math-ini'] = { version = 1.001, comment = "companion to math-ini.mkiv", author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", diff --git a/tex/context/base/math-ini.mkiv b/tex/context/base/math-ini.mkiv index 4f1ef3865..7f7577f2b 100644 --- a/tex/context/base/math-ini.mkiv +++ b/tex/context/base/math-ini.mkiv @@ -37,6 +37,7 @@ \registerctxluafile{math-act}{1.001} \registerctxluafile{math-ext}{1.001} \registerctxluafile{math-vfu}{1.001} +\registerctxluafile{math-ttv}{1.001} \registerctxluafile{math-map}{1.001} \registerctxluafile{math-ren}{1.001} \registerctxluafile{math-noa}{1.001} diff --git a/tex/context/base/math-ttv.lua b/tex/context/base/math-ttv.lua new file mode 100644 index 000000000..be7d1949b --- /dev/null +++ b/tex/context/base/math-ttv.lua @@ -0,0 +1,799 @@ +if not modules then modules = { } end modules ['math-ttv'] = { + version = 1.001, + comment = "traditional tex vectors, companion to math-vfu.lua", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files", + dataonly = true, +} + +local vfmath = fonts.handlers.vf.math +local setletters = vfmath.setletters +local setdigits = vfmath.setdigits + +local mathencodings = fonts.encodings.math + +-- varphi is part of the alphabet, contrary to the other var*s' + +mathencodings["large-to-small"] = { + [0x00028] = 0x00, -- ( + [0x00029] = 0x01, -- ) + [0x0005B] = 0x02, -- [ + [0x0005D] = 0x03, -- ] + [0x0230A] = 0x04, -- lfloor + [0x0230B] = 0x05, -- rfloor + [0x02308] = 0x06, -- lceil + [0x02309] = 0x07, -- rceil + [0x0007B] = 0x08, -- { + [0x0007D] = 0x09, -- } + [0x027E8] = 0x0A, -- < + [0x027E9] = 0x0B, -- > + [0x0007C] = 0x0C, -- | +--~ [0x0] = 0x0D, -- lVert rVert Vert +-- [0x0002F] = 0x0E, -- / + [0x0005C] = 0x0F, -- \ +--~ [0x0] = 0x3A, -- lgroup +--~ [0x0] = 0x3B, -- rgroup +--~ [0x0] = 0x3C, -- arrowvert +--~ [0x0] = 0x3D, -- Arrowvert + [0x02195] = 0x3F, -- updownarrow +--~ [0x0] = 0x40, -- lmoustache +--~ [0x0] = 0x41, -- rmoustache + [0x0221A] = 0x70, -- sqrt + [0x021D5] = 0x77, -- Updownarrow + [0x02191] = 0x78, -- uparrow + [0x02193] = 0x79, -- downarrow + [0x021D1] = 0x7E, -- Uparrow + [0x021D3] = 0x7F, -- Downarrow + [0x0220F] = 0x59, -- prod + [0x02210] = 0x61, -- coprod + [0x02211] = 0x58, -- sum + [0x0222B] = 0x5A, -- intop + [0x0222E] = 0x49, -- ointop + [0xFE302] = 0x62, -- widehat + [0xFE303] = 0x65, -- widetilde + [0x022C0] = 0x5E, -- bigwedge + [0x022C1] = 0x5F, -- bigvee + [0x022C2] = 0x5C, -- bigcap + [0x022C3] = 0x5B, -- bigcup + [0x02044] = 0x0E, -- / +} + +-- Beware: these are (in cm/lm) below the baseline due to limitations +-- in the tfm format bu the engien (combined with the mathclass) takes +-- care of it. If we need them in textmode, we should make them virtual +-- and move them up but we're in no hurry with that. + +mathencodings["tex-ex"] = { + [0x0220F] = 0x51, -- prod + [0x02210] = 0x60, -- coprod + [0x02211] = 0x50, -- sum + [0x0222B] = 0x52, -- intop + [0x0222E] = 0x48, -- ointop + [0x022C0] = 0x56, -- bigwedge + [0x022C1] = 0x57, -- bigvee + [0x022C2] = 0x54, -- bigcap + [0x022C3] = 0x53, -- bigcup + [0x02A00] = 0x4A, -- bigodot -- fixed BJ + [0x02A01] = 0x4C, -- bigoplus + [0x02A02] = 0x4E, -- bigotimes + -- [0x02A03] = , -- bigudot -- + [0x02A04] = 0x55, -- biguplus + [0x02A06] = 0x46, -- bigsqcup +} + +-- only math stuff is needed, since we always use an lm or gyre +-- font as main font + +mathencodings["tex-mr"] = { + [0x00393] = 0x00, -- Gamma + [0x00394] = 0x01, -- Delta + [0x00398] = 0x02, -- Theta + [0x0039B] = 0x03, -- Lambda + [0x0039E] = 0x04, -- Xi + [0x003A0] = 0x05, -- Pi + [0x003A3] = 0x06, -- Sigma + [0x003A5] = 0x07, -- Upsilon + [0x003A6] = 0x08, -- Phi + [0x003A8] = 0x09, -- Psi + [0x003A9] = 0x0A, -- Omega +-- [0x00060] = 0x12, -- [math]grave +-- [0x000B4] = 0x13, -- [math]acute +-- [0x002C7] = 0x14, -- [math]check +-- [0x002D8] = 0x15, -- [math]breve +-- [0x000AF] = 0x16, -- [math]bar +-- [0x00021] = 0x21, -- ! +-- [0x00028] = 0x28, -- ( +-- [0x00029] = 0x29, -- ) +-- [0x0002B] = 0x2B, -- + +-- [0x0002F] = 0x2F, -- / +-- [0x0003A] = 0x3A, -- : +-- [0x02236] = 0x3A, -- colon +-- [0x0003B] = 0x3B, -- ; +-- [0x0003C] = 0x3C, -- < +-- [0x0003D] = 0x3D, -- = +-- [0x0003E] = 0x3E, -- > +-- [0x0003F] = 0x3F, -- ? + [0x00391] = 0x41, -- Alpha + [0x00392] = 0x42, -- Beta + [0x02145] = 0x44, + [0x00395] = 0x45, -- Epsilon + [0x00397] = 0x48, -- Eta + [0x00399] = 0x49, -- Iota + [0x0039A] = 0x4B, -- Kappa + [0x0039C] = 0x4D, -- Mu + [0x0039D] = 0x4E, -- Nu + [0x0039F] = 0x4F, -- Omicron + [0x003A1] = 0x52, -- Rho + [0x003A4] = 0x54, -- Tau + [0x003A7] = 0x58, -- Chi + [0x00396] = 0x5A, -- Zeta +-- [0x0005B] = 0x5B, -- [ +-- [0x0005D] = 0x5D, -- ] +-- [0x0005E] = 0x5E, -- [math]hat -- the text one + [0x00302] = 0x5E, -- [math]hat -- the real math one +-- [0x002D9] = 0x5F, -- [math]dot + [0x02146] = 0x64, + [0x02147] = 0x65, +-- [0x002DC] = 0x7E, -- [math]tilde -- the text one + [0x00303] = 0x7E, -- [math]tilde -- the real one +-- [0x000A8] = 0x7F, -- [math]ddot +} + +mathencodings["tex-mr-missing"] = { + [0x02236] = 0x3A, -- colon +} + +mathencodings["tex-mi"] = { + [0x1D6E4] = 0x00, -- Gamma + [0x1D6E5] = 0x01, -- Delta + [0x1D6E9] = 0x02, -- Theta + [0x1D6F3] = 0x02, -- varTheta (not present in TeX) + [0x1D6EC] = 0x03, -- Lambda + [0x1D6EF] = 0x04, -- Xi + [0x1D6F1] = 0x05, -- Pi + [0x1D6F4] = 0x06, -- Sigma + [0x1D6F6] = 0x07, -- Upsilon + [0x1D6F7] = 0x08, -- Phi + [0x1D6F9] = 0x09, -- Psi + [0x1D6FA] = 0x0A, -- Omega + [0x1D6FC] = 0x0B, -- alpha + [0x1D6FD] = 0x0C, -- beta + [0x1D6FE] = 0x0D, -- gamma + [0x1D6FF] = 0x0E, -- delta + [0x1D716] = 0x0F, -- epsilon TODO: 1D716 + [0x1D701] = 0x10, -- zeta + [0x1D702] = 0x11, -- eta + [0x1D703] = 0x12, -- theta TODO: 1D703 + [0x1D704] = 0x13, -- iota + [0x1D705] = 0x14, -- kappa + [0x1D718] = 0x14, -- varkappa, not in tex fonts + [0x1D706] = 0x15, -- lambda + [0x1D707] = 0x16, -- mu + [0x1D708] = 0x17, -- nu + [0x1D709] = 0x18, -- xi + [0x1D70B] = 0x19, -- pi + [0x1D70C] = 0x1A, -- rho + [0x1D70E] = 0x1B, -- sigma + [0x1D70F] = 0x1C, -- tau + [0x1D710] = 0x1D, -- upsilon + [0x1D719] = 0x1E, -- phi + [0x1D712] = 0x1F, -- chi + [0x1D713] = 0x20, -- psi + [0x1D714] = 0x21, -- omega + [0x1D700] = 0x22, -- varepsilon (the other way around) + [0x1D717] = 0x23, -- vartheta + [0x1D71B] = 0x24, -- varpi + [0x1D71A] = 0x25, -- varrho + [0x1D70D] = 0x26, -- varsigma + [0x1D711] = 0x27, -- varphi (the other way around) + [0x021BC] = 0x28, -- leftharpoonup + [0x021BD] = 0x29, -- leftharpoondown + [0x021C0] = 0x2A, -- rightharpoonup + [0x021C1] = 0x2B, -- rightharpoondown + [0xFE322] = 0x2C, -- lhook (hook for combining arrows) + [0xFE323] = 0x2D, -- rhook (hook for combining arrows) + [0x025B7] = 0x2E, -- triangleright : cf lmmath / BJ + [0x025C1] = 0x2F, -- triangleleft : cf lmmath / BJ + [0x022B3] = 0x2E, -- triangleright : cf lmmath this a cramped triangles / BJ / see * + [0x022B2] = 0x2F, -- triangleleft : cf lmmath this a cramped triangles / BJ / see * +-- [0x00041] = 0x30, -- 0 +-- [0x00041] = 0x31, -- 1 +-- [0x00041] = 0x32, -- 2 +-- [0x00041] = 0x33, -- 3 +-- [0x00041] = 0x34, -- 4 +-- [0x00041] = 0x35, -- 5 +-- [0x00041] = 0x36, -- 6 +-- [0x00041] = 0x37, -- 7 +-- [0x00041] = 0x38, -- 8 +-- [0x00041] = 0x39, -- 9 +--~ [0x0002E] = 0x3A, -- . + [0x0002C] = 0x3B, -- , + [0x0003C] = 0x3C, -- < +-- [0x0002F] = 0x3D, -- /, slash, solidus + [0x02044] = 0x3D, -- / AM: Not sure + [0x0003E] = 0x3E, -- > + [0x022C6] = 0x3F, -- star + [0x02202] = 0x40, -- partial +-- + [0x0266D] = 0x5B, -- flat + [0x0266E] = 0x5C, -- natural + [0x0266F] = 0x5D, -- sharp + [0x02323] = 0x5E, -- smile + [0x02322] = 0x5F, -- frown + [0x02113] = 0x60, -- ell +-- + [0x1D6A4] = 0x7B, -- imath (TODO: also 0131) + [0x1D6A5] = 0x7C, -- jmath (TODO: also 0237) + [0x02118] = 0x7D, -- wp + [0x020D7] = 0x7E, -- vec (TODO: not sure) +-- 0x7F, -- (no idea what that could be) +} + +mathencodings["tex-it"] = { +-- [0x1D434] = 0x41, -- A + [0x1D6E2] = 0x41, -- Alpha +-- [0x1D435] = 0x42, -- B + [0x1D6E3] = 0x42, -- Beta +-- [0x1D436] = 0x43, -- C +-- [0x1D437] = 0x44, -- D +-- [0x1D438] = 0x45, -- E + [0x1D6E6] = 0x45, -- Epsilon +-- [0x1D439] = 0x46, -- F +-- [0x1D43A] = 0x47, -- G +-- [0x1D43B] = 0x48, -- H + [0x1D6E8] = 0x48, -- Eta +-- [0x1D43C] = 0x49, -- I + [0x1D6EA] = 0x49, -- Iota +-- [0x1D43D] = 0x4A, -- J +-- [0x1D43E] = 0x4B, -- K + [0x1D6EB] = 0x4B, -- Kappa +-- [0x1D43F] = 0x4C, -- L +-- [0x1D440] = 0x4D, -- M + [0x1D6ED] = 0x4D, -- Mu +-- [0x1D441] = 0x4E, -- N + [0x1D6EE] = 0x4E, -- Nu +-- [0x1D442] = 0x4F, -- O + [0x1D6F0] = 0x4F, -- Omicron +-- [0x1D443] = 0x50, -- P + [0x1D6F2] = 0x50, -- Rho +-- [0x1D444] = 0x51, -- Q +-- [0x1D445] = 0x52, -- R +-- [0x1D446] = 0x53, -- S +-- [0x1D447] = 0x54, -- T + [0x1D6F5] = 0x54, -- Tau +-- [0x1D448] = 0x55, -- U +-- [0x1D449] = 0x56, -- V +-- [0x1D44A] = 0x57, -- W +-- [0x1D44B] = 0x58, -- X + [0x1D6F8] = 0x58, -- Chi +-- [0x1D44C] = 0x59, -- Y +-- [0x1D44D] = 0x5A, -- Z +-- +-- [0x1D44E] = 0x61, -- a +-- [0x1D44F] = 0x62, -- b +-- [0x1D450] = 0x63, -- c +-- [0x1D451] = 0x64, -- d +-- [0x1D452] = 0x65, -- e +-- [0x1D453] = 0x66, -- f +-- [0x1D454] = 0x67, -- g +-- [0x1D455] = 0x68, -- h + [0x0210E] = 0x68, -- Planck constant (h) +-- [0x1D456] = 0x69, -- i +-- [0x1D457] = 0x6A, -- j +-- [0x1D458] = 0x6B, -- k +-- [0x1D459] = 0x6C, -- l +-- [0x1D45A] = 0x6D, -- m +-- [0x1D45B] = 0x6E, -- n +-- [0x1D45C] = 0x6F, -- o + [0x1D70A] = 0x6F, -- omicron +-- [0x1D45D] = 0x70, -- p +-- [0x1D45E] = 0x71, -- q +-- [0x1D45F] = 0x72, -- r +-- [0x1D460] = 0x73, -- s +-- [0x1D461] = 0x74, -- t +-- [0x1D462] = 0x75, -- u +-- [0x1D463] = 0x76, -- v +-- [0x1D464] = 0x77, -- w +-- [0x1D465] = 0x78, -- x +-- [0x1D466] = 0x79, -- y +-- [0x1D467] = 0x7A, -- z +} + +mathencodings["tex-ss"] = { } +mathencodings["tex-tt"] = { } +mathencodings["tex-bf"] = { } +mathencodings["tex-bi"] = { } +mathencodings["tex-fraktur"] = { } +mathencodings["tex-fraktur-bold"] = { } + +mathencodings["tex-sy"] = { + [0x0002D] = 0x00, -- - + [0x02212] = 0x00, -- - +-- [0x02201] = 0x00, -- complement +-- [0x02206] = 0x00, -- increment +-- [0x02204] = 0x00, -- not exists +-- [0x000B7] = 0x01, -- cdot + [0x022C5] = 0x01, -- cdot + [0x000D7] = 0x02, -- times + [0x0002A] = 0x03, -- * + [0x02217] = 0x03, -- * + [0x000F7] = 0x04, -- div + [0x022C4] = 0x05, -- diamond + [0x000B1] = 0x06, -- pm + [0x02213] = 0x07, -- mp + [0x02295] = 0x08, -- oplus + [0x02296] = 0x09, -- ominus + [0x02297] = 0x0A, -- otimes + [0x02298] = 0x0B, -- oslash + [0x02299] = 0x0C, -- odot + [0x025EF] = 0x0D, -- bigcirc, Orb (either 25EF or 25CB) -- todo + [0x02218] = 0x0E, -- circ + [0x02219] = 0x0F, -- bullet + [0x02022] = 0x0F, -- bullet + [0x0224D] = 0x10, -- asymp + [0x02261] = 0x11, -- equiv + [0x02286] = 0x12, -- subseteq + [0x02287] = 0x13, -- supseteq + [0x02264] = 0x14, -- leq + [0x02265] = 0x15, -- geq + [0x02AAF] = 0x16, -- preceq +-- [0x0227C] = 0x16, -- preceq, AM:No see 2AAF + [0x02AB0] = 0x17, -- succeq +-- [0x0227D] = 0x17, -- succeq, AM:No see 2AB0 + [0x0223C] = 0x18, -- sim + [0x02248] = 0x19, -- approx + [0x02282] = 0x1A, -- subset + [0x02283] = 0x1B, -- supset + [0x0226A] = 0x1C, -- ll + [0x0226B] = 0x1D, -- gg + [0x0227A] = 0x1E, -- prec + [0x0227B] = 0x1F, -- succ + [0x02190] = 0x20, -- leftarrow + [0x02192] = 0x21, -- rightarrow +--~ [0xFE190] = 0x20, -- leftarrow +--~ [0xFE192] = 0x21, -- rightarrow + [0x02191] = 0x22, -- uparrow + [0x02193] = 0x23, -- downarrow + [0x02194] = 0x24, -- leftrightarrow + [0x02197] = 0x25, -- nearrow + [0x02198] = 0x26, -- searrow + [0x02243] = 0x27, -- simeq + [0x021D0] = 0x28, -- Leftarrow + [0x021D2] = 0x29, -- Rightarrow + [0x021D1] = 0x2A, -- Uparrow + [0x021D3] = 0x2B, -- Downarrow + [0x021D4] = 0x2C, -- Leftrightarrow + [0x02196] = 0x2D, -- nwarrow + [0x02199] = 0x2E, -- swarrow + [0x0221D] = 0x2F, -- propto + [0x02032] = 0x30, -- prime + [0x0221E] = 0x31, -- infty + [0x02208] = 0x32, -- in + [0x0220B] = 0x33, -- ni + [0x025B3] = 0x34, -- triangle, bigtriangleup + [0x025BD] = 0x35, -- bigtriangledown + [0x00338] = 0x36, -- not +-- 0x37, -- (beginning of arrow) + [0x02200] = 0x38, -- forall + [0x02203] = 0x39, -- exists + [0x000AC] = 0x3A, -- neg, lnot + [0x02205] = 0x3B, -- empty set + [0x0211C] = 0x3C, -- Re + [0x02111] = 0x3D, -- Im + [0x022A4] = 0x3E, -- top + [0x022A5] = 0x3F, -- bot, perp + [0x02135] = 0x40, -- aleph + [0x1D49C] = 0x41, -- script A + [0x0212C] = 0x42, -- script B + [0x1D49E] = 0x43, -- script C + [0x1D49F] = 0x44, -- script D + [0x02130] = 0x45, -- script E + [0x02131] = 0x46, -- script F + [0x1D4A2] = 0x47, -- script G + [0x0210B] = 0x48, -- script H + [0x02110] = 0x49, -- script I + [0x1D4A5] = 0x4A, -- script J + [0x1D4A6] = 0x4B, -- script K + [0x02112] = 0x4C, -- script L + [0x02133] = 0x4D, -- script M + [0x1D4A9] = 0x4E, -- script N + [0x1D4AA] = 0x4F, -- script O + [0x1D4AB] = 0x50, -- script P + [0x1D4AC] = 0x51, -- script Q + [0x0211B] = 0x52, -- script R + [0x1D4AE] = 0x53, -- script S + [0x1D4AF] = 0x54, -- script T + [0x1D4B0] = 0x55, -- script U + [0x1D4B1] = 0x56, -- script V + [0x1D4B2] = 0x57, -- script W + [0x1D4B3] = 0x58, -- script X + [0x1D4B4] = 0x59, -- script Y + [0x1D4B5] = 0x5A, -- script Z + [0x0222A] = 0x5B, -- cup + [0x02229] = 0x5C, -- cap + [0x0228E] = 0x5D, -- uplus + [0x02227] = 0x5E, -- wedge, land + [0x02228] = 0x5F, -- vee, lor + [0x022A2] = 0x60, -- vdash + [0x022A3] = 0x61, -- dashv + [0x0230A] = 0x62, -- lfloor + [0x0230B] = 0x63, -- rfloor + [0x02308] = 0x64, -- lceil + [0x02309] = 0x65, -- rceil + [0x0007B] = 0x66, -- {, lbrace + [0x0007D] = 0x67, -- }, rbrace + [0x027E8] = 0x68, -- <, langle + [0x027E9] = 0x69, -- >, rangle + [0x0007C] = 0x6A, -- |, mid, lvert, rvert + [0x02225] = 0x6B, -- parallel + -- [0x02016] = 0x00, -- Vert, lVert, rVert, arrowvert, Arrowvert + [0x02195] = 0x6C, -- updownarrow + [0x021D5] = 0x6D, -- Updownarrow + [0x0005C] = 0x6E, -- \, backslash, setminus + [0x02216] = 0x6E, -- setminus + [0x02240] = 0x6F, -- wr + [0x0221A] = 0x70, -- sqrt. AM: Check surd?? + [0x02A3F] = 0x71, -- amalg + [0x1D6FB] = 0x72, -- nabla +-- [0x0222B] = 0x73, -- smallint (TODO: what about intop?) + [0x02294] = 0x74, -- sqcup + [0x02293] = 0x75, -- sqcap + [0x02291] = 0x76, -- sqsubseteq + [0x02292] = 0x77, -- sqsupseteq + [0x000A7] = 0x78, -- S + [0x02020] = 0x79, -- dagger, dag + [0x02021] = 0x7A, -- ddagger, ddag + [0x000B6] = 0x7B, -- P + [0x02663] = 0x7C, -- clubsuit + [0x02662] = 0x7D, -- diamondsuit + [0x02661] = 0x7E, -- heartsuit + [0x02660] = 0x7F, -- spadesuit + [0xFE321] = 0x37, -- mapstochar + + [0xFE325] = 0x30, -- prime 0x02032 +} + +-- The names in masm10.enc can be trusted best and are shown in the first +-- column, while in the second column we show the tex/ams names. As usual +-- it costs hours to figure out such a table. + +mathencodings["tex-ma"] = { + [0x022A1] = 0x00, -- squaredot \boxdot + [0x0229E] = 0x01, -- squareplus \boxplus + [0x022A0] = 0x02, -- squaremultiply \boxtimes + [0x025A1] = 0x03, -- square \square \Box + [0x025A0] = 0x04, -- squaresolid \blacksquare + [0x025AA] = 0x05, -- squaresmallsolid \centerdot + [0x022C4] = 0x06, -- diamond \Diamond \lozenge + [0x02666] = 0x07, -- diamondsolid \blacklozenge + [0x021BB] = 0x08, -- clockwise \circlearrowright + [0x021BA] = 0x09, -- anticlockwise \circlearrowleft + [0x021CC] = 0x0A, -- harpoonleftright \rightleftharpoons + [0x021CB] = 0x0B, -- harpoonrightleft \leftrightharpoons + [0x0229F] = 0x0C, -- squareminus \boxminus + [0x022A9] = 0x0D, -- forces \Vdash + [0x022AA] = 0x0E, -- forcesbar \Vvdash + [0x022A8] = 0x0F, -- satisfies \vDash + [0x021A0] = 0x10, -- dblarrowheadright \twoheadrightarrow + [0x0219E] = 0x11, -- dblarrowheadleft \twoheadleftarrow + [0x021C7] = 0x12, -- dblarrowleft \leftleftarrows + [0x021C9] = 0x13, -- dblarrowright \rightrightarrows + [0x021C8] = 0x14, -- dblarrowup \upuparrows + [0x021CA] = 0x15, -- dblarrowdwn \downdownarrows + [0x021BE] = 0x16, -- harpoonupright \upharpoonright \restriction + [0x021C2] = 0x17, -- harpoondownright \downharpoonright + [0x021BF] = 0x18, -- harpoonupleft \upharpoonleft + [0x021C3] = 0x19, -- harpoondownleft \downharpoonleft + [0x021A3] = 0x1A, -- arrowtailright \rightarrowtail + [0x021A2] = 0x1B, -- arrowtailleft \leftarrowtail + [0x021C6] = 0x1C, -- arrowparrleftright \leftrightarrows +-- [0x021C5] = 0x00, -- \updownarrows (missing in lm) + [0x021C4] = 0x1D, -- arrowparrrightleft \rightleftarrows + [0x021B0] = 0x1E, -- shiftleft \Lsh + [0x021B1] = 0x1F, -- shiftright \Rsh + [0x021DD] = 0x20, -- squiggleright \leadsto \rightsquigarrow + [0x021AD] = 0x21, -- squiggleleftright \leftrightsquigarrow + [0x021AB] = 0x22, -- curlyleft \looparrowleft + [0x021AC] = 0x23, -- curlyright \looparrowright + [0x02257] = 0x24, -- circleequal \circeq + [0x0227F] = 0x25, -- followsorequal \succsim + [0x02273] = 0x26, -- greaterorsimilar \gtrsim + [0x02A86] = 0x27, -- greaterorapproxeql \gtrapprox + [0x022B8] = 0x28, -- multimap \multimap + [0x02234] = 0x29, -- therefore \therefore + [0x02235] = 0x2A, -- because \because + [0x02251] = 0x2B, -- equalsdots \Doteq \doteqdot + [0x0225C] = 0x2C, -- defines \triangleq + [0x0227E] = 0x2D, -- precedesorequal \precsim + [0x02272] = 0x2E, -- lessorsimilar \lesssim + [0x02A85] = 0x2F, -- lessorapproxeql \lessapprox + [0x02A95] = 0x30, -- equalorless \eqslantless + [0x02A96] = 0x31, -- equalorgreater \eqslantgtr + [0x022DE] = 0x32, -- equalorprecedes \curlyeqprec + [0x022DF] = 0x33, -- equalorfollows \curlyeqsucc + [0x0227C] = 0x34, -- precedesorcurly \preccurlyeq + [0x02266] = 0x35, -- lessdblequal \leqq + [0x02A7D] = 0x36, -- lessorequalslant \leqslant + [0x02276] = 0x37, -- lessorgreater \lessgtr + [0x02035] = 0x38, -- primereverse \backprime + -- [0x0] = 0x39, -- axisshort \dabar + [0x02253] = 0x3A, -- equaldotrightleft \risingdotseq + [0x02252] = 0x3B, -- equaldotleftright \fallingdotseq + [0x0227D] = 0x3C, -- followsorcurly \succcurlyeq + [0x02267] = 0x3D, -- greaterdblequal \geqq + [0x02A7E] = 0x3E, -- greaterorequalslant \geqslant + [0x02277] = 0x3F, -- greaterorless \gtrless + [0x0228F] = 0x40, -- squareimage \sqsubset + [0x02290] = 0x41, -- squareoriginal \sqsupset + -- wrong: see ** + -- [0x022B3] = 0x42, -- triangleright \rhd \vartriangleright + -- [0x022B2] = 0x43, -- triangleleft \lhd \vartriangleleft + -- cf lm + [0x022B5] = 0x44, -- trianglerightequal \unrhd \trianglerighteq + [0x022B4] = 0x45, -- triangleleftequal \unlhd \trianglelefteq + -- + [0x02605] = 0x46, -- star \bigstar + [0x0226C] = 0x47, -- between \between + [0x025BC] = 0x48, -- triangledownsld \blacktriangledown + [0x025B6] = 0x49, -- trianglerightsld \blacktriangleright + [0x025C0] = 0x4A, -- triangleleftsld \blacktriangleleft + -- [0x0] = 0x4B, -- arrowaxisright + -- [0x0] = 0x4C, -- arrowaxisleft + [0x025B2] = 0x4D, -- triangle \triangleup \vartriangle + [0x025B2] = 0x4E, -- trianglesolid \blacktriangle + [0x025BD] = 0x4F, -- triangleinv \triangledown + [0x02256] = 0x50, -- ringinequal \eqcirc + [0x022DA] = 0x51, -- lessequalgreater \lesseqgtr + [0x022DB] = 0x52, -- greaterlessequal \gtreqless + [0x02A8B] = 0x53, -- lessdbleqlgreater \lesseqqgtr + [0x02A8C] = 0x54, -- greaterdbleqlless \gtreqqless + [0x000A5] = 0x55, -- Yen \yen + [0x021DB] = 0x56, -- arrowtripleright \Rrightarrow + [0x021DA] = 0x57, -- arrowtripleleft \Lleftarrow + [0x02713] = 0x58, -- check \checkmark + [0x022BB] = 0x59, -- orunderscore \veebar + [0x022BC] = 0x5A, -- nand \barwedge + [0x02306] = 0x5B, -- perpcorrespond \doublebarwedge + [0x02220] = 0x5C, -- angle \angle + [0x02221] = 0x5D, -- measuredangle \measuredangle + [0x02222] = 0x5E, -- sphericalangle \sphericalangle + -- [0x0] = 0x5F, -- proportional \varpropto + -- [0x0] = 0x60, -- smile \smallsmile + -- [0x0] = 0x61, -- frown \smallfrown + [0x022D0] = 0x62, -- subsetdbl \Subset + [0x022D1] = 0x63, -- supersetdbl \Supset + [0x022D3] = 0x64, -- uniondbl \doublecup \Cup + [0x022D2] = 0x65, -- intersectiondbl \doublecap \Cap + [0x022CF] = 0x66, -- uprise \curlywedge + [0x022CE] = 0x67, -- downfall \curlyvee + [0x022CB] = 0x68, -- multiopenleft \leftthreetimes + [0x022CC] = 0x69, -- multiopenright \rightthreetimes + [0x02AC5] = 0x6A, -- subsetdblequal \subseteqq + [0x02AC6] = 0x6B, -- supersetdblequal \supseteqq + [0x0224F] = 0x6C, -- difference \bumpeq + [0x0224E] = 0x6D, -- geomequivalent \Bumpeq + [0x022D8] = 0x6E, -- muchless \lll \llless + [0x022D9] = 0x6F, -- muchgreater \ggg \gggtr + [0x0231C] = 0x70, -- rightanglenw \ulcorner + [0x0231D] = 0x71, -- rightanglene \urcorner + [0x024C7] = 0x72, -- circleR \circledR + [0x024C8] = 0x73, -- circleS \circledS + [0x022D4] = 0x74, -- fork \pitchfork + [0x02214] = 0x75, -- dotplus \dotplus + [0x0223D] = 0x76, -- revsimilar \backsim + [0x022CD] = 0x77, -- revasymptequal \backsimeq -- AM: Check this! I mapped it to simeq. + [0x0231E] = 0x78, -- rightanglesw \llcorner + [0x0231F] = 0x79, -- rightanglese \lrcorner + [0x02720] = 0x7A, -- maltesecross \maltese + [0x02201] = 0x7B, -- complement \complement + [0x022BA] = 0x7C, -- intercal \intercal + [0x0229A] = 0x7D, -- circlering \circledcirc + [0x0229B] = 0x7E, -- circleasterisk \circledast + [0x0229D] = 0x7F, -- circleminus \circleddash +} + +mathencodings["tex-mb"] = { + -- [0x0] = 0x00, -- lessornotequal \lvertneqq + -- [0x0] = 0x01, -- greaterornotequal \gvertneqq + [0x02270] = 0x02, -- notlessequal \nleq + [0x02271] = 0x03, -- notgreaterequal \ngeq + [0x0226E] = 0x04, -- notless \nless + [0x0226F] = 0x05, -- notgreater \ngtr + [0x02280] = 0x06, -- notprecedes \nprec + [0x02281] = 0x07, -- notfollows \nsucc + [0x02268] = 0x08, -- lessornotdbleql \lneqq + [0x02269] = 0x09, -- greaterornotdbleql \gneqq + -- [0x0] = 0x0A, -- notlessorslnteql \nleqslant + -- [0x0] = 0x0B, -- notgreaterorslnteql \ngeqslant + [0x02A87] = 0x0C, -- lessnotequal \lneq + [0x02A88] = 0x0D, -- greaternotequal \gneq + -- [0x0] = 0x0E, -- notprecedesoreql \npreceq + -- [0x0] = 0x0F, -- notfollowsoreql \nsucceq + [0x022E8] = 0x10, -- precedeornoteqvlnt \precnsim + [0x022E9] = 0x11, -- followornoteqvlnt \succnsim + [0x022E6] = 0x12, -- lessornotsimilar \lnsim + [0x022E7] = 0x13, -- greaterornotsimilar \gnsim + -- [0x0] = 0x14, -- notlessdblequal \nleqq + -- [0x0] = 0x15, -- notgreaterdblequal \ngeqq + [0x02AB5] = 0x16, -- precedenotslnteql \precneqq + [0x02AB6] = 0x17, -- follownotslnteql \succneqq + [0x02AB9] = 0x18, -- precedenotdbleqv \precnapprox + [0x02ABA] = 0x19, -- follownotdbleqv \succnapprox + [0x02A89] = 0x1A, -- lessnotdblequal \lnapprox + [0x02A8A] = 0x1B, -- greaternotdblequal \gnapprox + [0x02241] = 0x1C, -- notsimilar \nsim + [0x02247] = 0x1D, -- notapproxequal \ncong + -- [0x0] = 0x1E, -- upslope \diagup + -- [0x0] = 0x1F, -- downslope \diagdown + -- [0x0] = 0x20, -- notsubsetoreql \varsubsetneq + -- [0x0] = 0x21, -- notsupersetoreql \varsupsetneq + -- [0x0] = 0x22, -- notsubsetordbleql \nsubseteqq + -- [0x0] = 0x23, -- notsupersetordbleql \nsupseteqq + [0x02ACB] = 0x24, -- subsetornotdbleql \subsetneqq + [0x02ACC] = 0x25, -- supersetornotdbleql \supsetneqq + -- [0x0] = 0x26, -- subsetornoteql \varsubsetneqq + -- [0x0] = 0x27, -- supersetornoteql \varsupsetneqq + [0x0228A] = 0x28, -- subsetnoteql \subsetneq + [0x0228B] = 0x29, -- supersetnoteql \supsetneq + [0x02288] = 0x2A, -- notsubseteql \nsubseteq + [0x02289] = 0x2B, -- notsuperseteql \nsupseteq + [0x02226] = 0x2C, -- notparallel \nparallel + [0x02224] = 0x2D, -- notbar \nmid \ndivides + -- [0x0] = 0x2E, -- notshortbar \nshortmid + -- [0x0] = 0x2F, -- notshortparallel \nshortparallel + [0x022AC] = 0x30, -- notturnstile \nvdash + [0x022AE] = 0x31, -- notforces \nVdash + [0x022AD] = 0x32, -- notsatisfies \nvDash + [0x022AF] = 0x33, -- notforcesextra \nVDash + [0x022ED] = 0x34, -- nottriangeqlright \ntrianglerighteq + [0x022EC] = 0x35, -- nottriangeqlleft \ntrianglelefteq + [0x022EA] = 0x36, -- nottriangleleft \ntriangleleft + [0x022EB] = 0x37, -- nottriangleright \ntriangleright + [0x0219A] = 0x38, -- notarrowleft \nleftarrow + [0x0219B] = 0x39, -- notarrowright \nrightarrow + [0x021CD] = 0x3A, -- notdblarrowleft \nLeftarrow + [0x021CF] = 0x3B, -- notdblarrowright \nRightarrow + [0x021CE] = 0x3C, -- notdblarrowboth \nLeftrightarrow + [0x021AE] = 0x3D, -- notarrowboth \nleftrightarrow + [0x022C7] = 0x3E, -- dividemultiply \divideontimes + [0x02300] = 0x3F, -- diametersign \varnothing + [0x02204] = 0x40, -- notexistential \nexists + [0x1D538] = 0x41, -- A (blackboard A) + [0x1D539] = 0x42, -- B + [0x02102] = 0x43, -- C + [0x1D53B] = 0x44, -- D + [0x1D53C] = 0x45, -- E + [0x1D53D] = 0x46, -- F + [0x1D53E] = 0x47, -- G + [0x0210D] = 0x48, -- H + [0x1D540] = 0x49, -- I + [0x1D541] = 0x4A, -- J + [0x1D542] = 0x4B, -- K + [0x1D543] = 0x4C, -- L + [0x1D544] = 0x4D, -- M + [0x02115] = 0x4E, -- N + [0x1D546] = 0x4F, -- O + [0x02119] = 0x50, -- P + [0x0211A] = 0x51, -- Q + [0x0211D] = 0x52, -- R + [0x1D54A] = 0x53, -- S + [0x1D54B] = 0x54, -- T + [0x1D54C] = 0x55, -- U + [0x1D54D] = 0x56, -- V + [0x1D54E] = 0x57, -- W + [0x1D54F] = 0x58, -- X + [0x1D550] = 0x59, -- Y + [0x02124] = 0x5A, -- Z (blackboard Z) + [0x02132] = 0x60, -- finv \Finv + [0x02141] = 0x61, -- fmir \Game + -- [0x0] = 0x62, tildewide + -- [0x0] = 0x63, tildewider + -- [0x0] = 0x64, Finv + -- [0x0] = 0x65, Gmir + [0x02127] = 0x66, -- Omegainv \mho + [0x000F0] = 0x67, -- eth \eth + [0x02242] = 0x68, -- equalorsimilar \eqsim + [0x02136] = 0x69, -- beth \beth + [0x02137] = 0x6A, -- gimel \gimel + [0x02138] = 0x6B, -- daleth \daleth + [0x022D6] = 0x6C, -- lessdot \lessdot + [0x022D7] = 0x6D, -- greaterdot \gtrdot + [0x022C9] = 0x6E, -- multicloseleft \ltimes + [0x022CA] = 0x6F, -- multicloseright \rtimes + -- [0x0] = 0x70, -- barshort \shortmid + -- [0x0] = 0x71, -- parallelshort \shortparallel + -- [0x02216] = 0x72, -- integerdivide \smallsetminus (2216 already part of tex-sy + -- [0x0] = 0x73, -- similar \thicksim + -- [0x0] = 0x74, -- approxequal \thickapprox + [0x0224A] = 0x75, -- approxorequal \approxeq + [0x02AB8] = 0x76, -- followsorequal \succapprox + [0x02AB7] = 0x77, -- precedesorequal \precapprox + [0x021B6] = 0x78, -- archleftdown \curvearrowleft + [0x021B7] = 0x79, -- archrightdown \curvearrowright + [0x003DC] = 0x7A, -- Digamma \digamma + [0x003F0] = 0x7B, -- kappa \varkappa + [0x1D55C] = 0x7C, -- k \Bbbk (blackboard k) + [0x0210F] = 0x7D, -- planckover2pi \hslash + [0x00127] = 0x7E, -- planckover2pi1 \hbar + [0x003F6] = 0x7F, -- epsiloninv \backepsilon +} + +mathencodings["tex-mc"] = { + -- this file has no tfm so it gets mapped in the private space + [0xFE324] = "mapsfromchar", +} + +mathencodings["tex-fraktur"] = { +-- [0x1D504] = 0x41, -- A (fraktur A) +-- [0x1D505] = 0x42, -- B + [0x0212D] = 0x43, -- C +-- [0x1D507] = 0x44, -- D +-- [0x1D508] = 0x45, -- E +-- [0x1D509] = 0x46, -- F +-- [0x1D50A] = 0x47, -- G + [0x0210C] = 0x48, -- H + [0x02111] = 0x49, -- I +-- [0x1D50D] = 0x4A, -- J +-- [0x1D50E] = 0x4B, -- K +-- [0x1D50F] = 0x4C, -- L +-- [0x1D510] = 0x4D, -- M +-- [0x1D511] = 0x4E, -- N +-- [0x1D512] = 0x4F, -- O +-- [0x1D513] = 0x50, -- P +-- [0x1D514] = 0x51, -- Q + [0x0211C] = 0x52, -- R +-- [0x1D516] = 0x53, -- S +-- [0x1D517] = 0x54, -- T +-- [0x1D518] = 0x55, -- U +-- [0x1D519] = 0x56, -- V +-- [0x1D51A] = 0x57, -- W +-- [0x1D51B] = 0x58, -- X +-- [0x1D51C] = 0x59, -- Y + [0x02128] = 0x5A, -- Z (fraktur Z) +-- [0x1D51E] = 0x61, -- a (fraktur a) +-- [0x1D51F] = 0x62, -- b +-- [0x1D520] = 0x63, -- c +-- [0x1D521] = 0x64, -- d +-- [0x1D522] = 0x65, -- e +-- [0x1D523] = 0x66, -- f +-- [0x1D524] = 0x67, -- g +-- [0x1D525] = 0x68, -- h +-- [0x1D526] = 0x69, -- i +-- [0x1D527] = 0x6A, -- j +-- [0x1D528] = 0x6B, -- k +-- [0x1D529] = 0x6C, -- l +-- [0x1D52A] = 0x6D, -- m +-- [0x1D52B] = 0x6E, -- n +-- [0x1D52C] = 0x6F, -- o +-- [0x1D52D] = 0x70, -- p +-- [0x1D52E] = 0x71, -- q +-- [0x1D52F] = 0x72, -- r +-- [0x1D530] = 0x73, -- s +-- [0x1D531] = 0x74, -- t +-- [0x1D532] = 0x75, -- u +-- [0x1D533] = 0x76, -- v +-- [0x1D534] = 0x77, -- w +-- [0x1D535] = 0x78, -- x +-- [0x1D536] = 0x79, -- y +-- [0x1D537] = 0x7A, -- z +} + +-- now that all other vectors are defined ... + +setletters(mathencodings, "tex-it", 0x1D434, 0x1D44E) +setletters(mathencodings, "tex-ss", 0x1D5A0, 0x1D5BA) +setletters(mathencodings, "tex-tt", 0x1D670, 0x1D68A) +setletters(mathencodings, "tex-bf", 0x1D400, 0x1D41A) +setletters(mathencodings, "tex-bi", 0x1D468, 0x1D482) +setletters(mathencodings, "tex-fraktur", 0x1D504, 0x1D51E) +setletters(mathencodings, "tex-fraktur-bold", 0x1D56C, 0x1D586) + +setdigits (mathencodings, "tex-ss", 0x1D7E2) +setdigits (mathencodings, "tex-tt", 0x1D7F6) +setdigits (mathencodings, "tex-bf", 0x1D7CE) + +-- setdigits (mathencodings, "tex-bi", 0x1D7CE) + +-- todo: add ss, tt, bf etc vectors +-- todo: we can make ss tt etc an option diff --git a/tex/context/base/math-vfu.lua b/tex/context/base/math-vfu.lua index 02de7efd6..b46e06a01 100644 --- a/tex/context/base/math-vfu.lua +++ b/tex/context/base/math-vfu.lua @@ -814,299 +814,7 @@ function mathematics.makefont(name,set,goodies) end end --- varphi is part of the alphabet, contrary to the other var*s' - -mathencodings["large-to-small"] = { - [0x00028] = 0x00, -- ( - [0x00029] = 0x01, -- ) - [0x0005B] = 0x02, -- [ - [0x0005D] = 0x03, -- ] - [0x0230A] = 0x04, -- lfloor - [0x0230B] = 0x05, -- rfloor - [0x02308] = 0x06, -- lceil - [0x02309] = 0x07, -- rceil - [0x0007B] = 0x08, -- { - [0x0007D] = 0x09, -- } - [0x027E8] = 0x0A, -- < - [0x027E9] = 0x0B, -- > - [0x0007C] = 0x0C, -- | ---~ [0x0] = 0x0D, -- lVert rVert Vert --- [0x0002F] = 0x0E, -- / - [0x0005C] = 0x0F, -- \ ---~ [0x0] = 0x3A, -- lgroup ---~ [0x0] = 0x3B, -- rgroup ---~ [0x0] = 0x3C, -- arrowvert ---~ [0x0] = 0x3D, -- Arrowvert - [0x02195] = 0x3F, -- updownarrow ---~ [0x0] = 0x40, -- lmoustache ---~ [0x0] = 0x41, -- rmoustache - [0x0221A] = 0x70, -- sqrt - [0x021D5] = 0x77, -- Updownarrow - [0x02191] = 0x78, -- uparrow - [0x02193] = 0x79, -- downarrow - [0x021D1] = 0x7E, -- Uparrow - [0x021D3] = 0x7F, -- Downarrow - [0x0220F] = 0x59, -- prod - [0x02210] = 0x61, -- coprod - [0x02211] = 0x58, -- sum - [0x0222B] = 0x5A, -- intop - [0x0222E] = 0x49, -- ointop - [0xFE302] = 0x62, -- widehat - [0xFE303] = 0x65, -- widetilde - [0x022C0] = 0x5E, -- bigwedge - [0x022C1] = 0x5F, -- bigvee - [0x022C2] = 0x5C, -- bigcap - [0x022C3] = 0x5B, -- bigcup - [0x02044] = 0x0E, -- / -} - --- Beware: these are (in cm/lm) below the baseline due to limitations --- in the tfm format bu the engien (combined with the mathclass) takes --- care of it. If we need them in textmode, we should make them virtual --- and move them up but we're in no hurry with that. - -mathencodings["tex-ex"] = { - [0x0220F] = 0x51, -- prod - [0x02210] = 0x60, -- coprod - [0x02211] = 0x50, -- sum - [0x0222B] = 0x52, -- intop - [0x0222E] = 0x48, -- ointop - [0x022C0] = 0x56, -- bigwedge - [0x022C1] = 0x57, -- bigvee - [0x022C2] = 0x54, -- bigcap - [0x022C3] = 0x53, -- bigcup - [0x02A00] = 0x4A, -- bigodot -- fixed BJ - [0x02A01] = 0x4C, -- bigoplus - [0x02A02] = 0x4E, -- bigotimes - -- [0x02A03] = , -- bigudot -- - [0x02A04] = 0x55, -- biguplus - [0x02A06] = 0x46, -- bigsqcup -} - --- only math stuff is needed, since we always use an lm or gyre --- font as main font - -mathencodings["tex-mr"] = { - [0x00393] = 0x00, -- Gamma - [0x00394] = 0x01, -- Delta - [0x00398] = 0x02, -- Theta - [0x0039B] = 0x03, -- Lambda - [0x0039E] = 0x04, -- Xi - [0x003A0] = 0x05, -- Pi - [0x003A3] = 0x06, -- Sigma - [0x003A5] = 0x07, -- Upsilon - [0x003A6] = 0x08, -- Phi - [0x003A8] = 0x09, -- Psi - [0x003A9] = 0x0A, -- Omega --- [0x00060] = 0x12, -- [math]grave --- [0x000B4] = 0x13, -- [math]acute --- [0x002C7] = 0x14, -- [math]check --- [0x002D8] = 0x15, -- [math]breve --- [0x000AF] = 0x16, -- [math]bar --- [0x00021] = 0x21, -- ! --- [0x00028] = 0x28, -- ( --- [0x00029] = 0x29, -- ) --- [0x0002B] = 0x2B, -- + --- [0x0002F] = 0x2F, -- / --- [0x0003A] = 0x3A, -- : --- [0x02236] = 0x3A, -- colon --- [0x0003B] = 0x3B, -- ; --- [0x0003C] = 0x3C, -- < --- [0x0003D] = 0x3D, -- = --- [0x0003E] = 0x3E, -- > --- [0x0003F] = 0x3F, -- ? - [0x00391] = 0x41, -- Alpha - [0x00392] = 0x42, -- Beta - [0x02145] = 0x44, - [0x00395] = 0x45, -- Epsilon - [0x00397] = 0x48, -- Eta - [0x00399] = 0x49, -- Iota - [0x0039A] = 0x4B, -- Kappa - [0x0039C] = 0x4D, -- Mu - [0x0039D] = 0x4E, -- Nu - [0x0039F] = 0x4F, -- Omicron - [0x003A1] = 0x52, -- Rho - [0x003A4] = 0x54, -- Tau - [0x003A7] = 0x58, -- Chi - [0x00396] = 0x5A, -- Zeta --- [0x0005B] = 0x5B, -- [ --- [0x0005D] = 0x5D, -- ] --- [0x0005E] = 0x5E, -- [math]hat -- the text one - [0x00302] = 0x5E, -- [math]hat -- the real math one --- [0x002D9] = 0x5F, -- [math]dot - [0x02146] = 0x64, - [0x02147] = 0x65, --- [0x002DC] = 0x7E, -- [math]tilde -- the text one - [0x00303] = 0x7E, -- [math]tilde -- the real one --- [0x000A8] = 0x7F, -- [math]ddot -} - -mathencodings["tex-mr-missing"] = { - [0x02236] = 0x3A, -- colon -} - -mathencodings["tex-mi"] = { - [0x1D6E4] = 0x00, -- Gamma - [0x1D6E5] = 0x01, -- Delta - [0x1D6E9] = 0x02, -- Theta - [0x1D6F3] = 0x02, -- varTheta (not present in TeX) - [0x1D6EC] = 0x03, -- Lambda - [0x1D6EF] = 0x04, -- Xi - [0x1D6F1] = 0x05, -- Pi - [0x1D6F4] = 0x06, -- Sigma - [0x1D6F6] = 0x07, -- Upsilon - [0x1D6F7] = 0x08, -- Phi - [0x1D6F9] = 0x09, -- Psi - [0x1D6FA] = 0x0A, -- Omega - [0x1D6FC] = 0x0B, -- alpha - [0x1D6FD] = 0x0C, -- beta - [0x1D6FE] = 0x0D, -- gamma - [0x1D6FF] = 0x0E, -- delta - [0x1D716] = 0x0F, -- epsilon TODO: 1D716 - [0x1D701] = 0x10, -- zeta - [0x1D702] = 0x11, -- eta - [0x1D703] = 0x12, -- theta TODO: 1D703 - [0x1D704] = 0x13, -- iota - [0x1D705] = 0x14, -- kappa - [0x1D718] = 0x14, -- varkappa, not in tex fonts - [0x1D706] = 0x15, -- lambda - [0x1D707] = 0x16, -- mu - [0x1D708] = 0x17, -- nu - [0x1D709] = 0x18, -- xi - [0x1D70B] = 0x19, -- pi - [0x1D70C] = 0x1A, -- rho - [0x1D70E] = 0x1B, -- sigma - [0x1D70F] = 0x1C, -- tau - [0x1D710] = 0x1D, -- upsilon - [0x1D719] = 0x1E, -- phi - [0x1D712] = 0x1F, -- chi - [0x1D713] = 0x20, -- psi - [0x1D714] = 0x21, -- omega - [0x1D700] = 0x22, -- varepsilon (the other way around) - [0x1D717] = 0x23, -- vartheta - [0x1D71B] = 0x24, -- varpi - [0x1D71A] = 0x25, -- varrho - [0x1D70D] = 0x26, -- varsigma - [0x1D711] = 0x27, -- varphi (the other way around) - [0x021BC] = 0x28, -- leftharpoonup - [0x021BD] = 0x29, -- leftharpoondown - [0x021C0] = 0x2A, -- rightharpoonup - [0x021C1] = 0x2B, -- rightharpoondown - [0xFE322] = 0x2C, -- lhook (hook for combining arrows) - [0xFE323] = 0x2D, -- rhook (hook for combining arrows) - [0x025B7] = 0x2E, -- triangleright : cf lmmath / BJ - [0x025C1] = 0x2F, -- triangleleft : cf lmmath / BJ - [0x022B3] = 0x2E, -- triangleright : cf lmmath this a cramped triangles / BJ / see * - [0x022B2] = 0x2F, -- triangleleft : cf lmmath this a cramped triangles / BJ / see * --- [0x00041] = 0x30, -- 0 --- [0x00041] = 0x31, -- 1 --- [0x00041] = 0x32, -- 2 --- [0x00041] = 0x33, -- 3 --- [0x00041] = 0x34, -- 4 --- [0x00041] = 0x35, -- 5 --- [0x00041] = 0x36, -- 6 --- [0x00041] = 0x37, -- 7 --- [0x00041] = 0x38, -- 8 --- [0x00041] = 0x39, -- 9 ---~ [0x0002E] = 0x3A, -- . - [0x0002C] = 0x3B, -- , - [0x0003C] = 0x3C, -- < --- [0x0002F] = 0x3D, -- /, slash, solidus - [0x02044] = 0x3D, -- / AM: Not sure - [0x0003E] = 0x3E, -- > - [0x022C6] = 0x3F, -- star - [0x02202] = 0x40, -- partial --- - [0x0266D] = 0x5B, -- flat - [0x0266E] = 0x5C, -- natural - [0x0266F] = 0x5D, -- sharp - [0x02323] = 0x5E, -- smile - [0x02322] = 0x5F, -- frown - [0x02113] = 0x60, -- ell --- - [0x1D6A4] = 0x7B, -- imath (TODO: also 0131) - [0x1D6A5] = 0x7C, -- jmath (TODO: also 0237) - [0x02118] = 0x7D, -- wp - [0x020D7] = 0x7E, -- vec (TODO: not sure) --- 0x7F, -- (no idea what that could be) -} - -mathencodings["tex-it"] = { --- [0x1D434] = 0x41, -- A - [0x1D6E2] = 0x41, -- Alpha --- [0x1D435] = 0x42, -- B - [0x1D6E3] = 0x42, -- Beta --- [0x1D436] = 0x43, -- C --- [0x1D437] = 0x44, -- D --- [0x1D438] = 0x45, -- E - [0x1D6E6] = 0x45, -- Epsilon --- [0x1D439] = 0x46, -- F --- [0x1D43A] = 0x47, -- G --- [0x1D43B] = 0x48, -- H - [0x1D6E8] = 0x48, -- Eta --- [0x1D43C] = 0x49, -- I - [0x1D6EA] = 0x49, -- Iota --- [0x1D43D] = 0x4A, -- J --- [0x1D43E] = 0x4B, -- K - [0x1D6EB] = 0x4B, -- Kappa --- [0x1D43F] = 0x4C, -- L --- [0x1D440] = 0x4D, -- M - [0x1D6ED] = 0x4D, -- Mu --- [0x1D441] = 0x4E, -- N - [0x1D6EE] = 0x4E, -- Nu --- [0x1D442] = 0x4F, -- O - [0x1D6F0] = 0x4F, -- Omicron --- [0x1D443] = 0x50, -- P - [0x1D6F2] = 0x50, -- Rho --- [0x1D444] = 0x51, -- Q --- [0x1D445] = 0x52, -- R --- [0x1D446] = 0x53, -- S --- [0x1D447] = 0x54, -- T - [0x1D6F5] = 0x54, -- Tau --- [0x1D448] = 0x55, -- U --- [0x1D449] = 0x56, -- V --- [0x1D44A] = 0x57, -- W --- [0x1D44B] = 0x58, -- X - [0x1D6F8] = 0x58, -- Chi --- [0x1D44C] = 0x59, -- Y --- [0x1D44D] = 0x5A, -- Z --- --- [0x1D44E] = 0x61, -- a --- [0x1D44F] = 0x62, -- b --- [0x1D450] = 0x63, -- c --- [0x1D451] = 0x64, -- d --- [0x1D452] = 0x65, -- e --- [0x1D453] = 0x66, -- f --- [0x1D454] = 0x67, -- g --- [0x1D455] = 0x68, -- h - [0x0210E] = 0x68, -- Planck constant (h) --- [0x1D456] = 0x69, -- i --- [0x1D457] = 0x6A, -- j --- [0x1D458] = 0x6B, -- k --- [0x1D459] = 0x6C, -- l --- [0x1D45A] = 0x6D, -- m --- [0x1D45B] = 0x6E, -- n --- [0x1D45C] = 0x6F, -- o - [0x1D70A] = 0x6F, -- omicron --- [0x1D45D] = 0x70, -- p --- [0x1D45E] = 0x71, -- q --- [0x1D45F] = 0x72, -- r --- [0x1D460] = 0x73, -- s --- [0x1D461] = 0x74, -- t --- [0x1D462] = 0x75, -- u --- [0x1D463] = 0x76, -- v --- [0x1D464] = 0x77, -- w --- [0x1D465] = 0x78, -- x --- [0x1D466] = 0x79, -- y --- [0x1D467] = 0x7A, -- z -} - -mathencodings["tex-ss"] = { } -mathencodings["tex-tt"] = { } -mathencodings["tex-bf"] = { } -mathencodings["tex-bi"] = { } -mathencodings["tex-fraktur"] = { } -mathencodings["tex-fraktur-bold"] = { } +-- helpers function vfmath.setletters(font_encoding, name, uppercase, lowercase) local enc = font_encoding[name] @@ -1122,494 +830,3 @@ function vfmath.setdigits(font_encoding, name, digits) enc[digits+i] = i + 0x30 end end - -mathencodings["tex-sy"] = { - [0x0002D] = 0x00, -- - - [0x02212] = 0x00, -- - --- [0x02201] = 0x00, -- complement --- [0x02206] = 0x00, -- increment --- [0x02204] = 0x00, -- not exists --- [0x000B7] = 0x01, -- cdot - [0x022C5] = 0x01, -- cdot - [0x000D7] = 0x02, -- times - [0x0002A] = 0x03, -- * - [0x02217] = 0x03, -- * - [0x000F7] = 0x04, -- div - [0x022C4] = 0x05, -- diamond - [0x000B1] = 0x06, -- pm - [0x02213] = 0x07, -- mp - [0x02295] = 0x08, -- oplus - [0x02296] = 0x09, -- ominus - [0x02297] = 0x0A, -- otimes - [0x02298] = 0x0B, -- oslash - [0x02299] = 0x0C, -- odot - [0x025EF] = 0x0D, -- bigcirc, Orb (either 25EF or 25CB) -- todo - [0x02218] = 0x0E, -- circ - [0x02219] = 0x0F, -- bullet - [0x02022] = 0x0F, -- bullet - [0x0224D] = 0x10, -- asymp - [0x02261] = 0x11, -- equiv - [0x02286] = 0x12, -- subseteq - [0x02287] = 0x13, -- supseteq - [0x02264] = 0x14, -- leq - [0x02265] = 0x15, -- geq - [0x02AAF] = 0x16, -- preceq --- [0x0227C] = 0x16, -- preceq, AM:No see 2AAF - [0x02AB0] = 0x17, -- succeq --- [0x0227D] = 0x17, -- succeq, AM:No see 2AB0 - [0x0223C] = 0x18, -- sim - [0x02248] = 0x19, -- approx - [0x02282] = 0x1A, -- subset - [0x02283] = 0x1B, -- supset - [0x0226A] = 0x1C, -- ll - [0x0226B] = 0x1D, -- gg - [0x0227A] = 0x1E, -- prec - [0x0227B] = 0x1F, -- succ - [0x02190] = 0x20, -- leftarrow - [0x02192] = 0x21, -- rightarrow ---~ [0xFE190] = 0x20, -- leftarrow ---~ [0xFE192] = 0x21, -- rightarrow - [0x02191] = 0x22, -- uparrow - [0x02193] = 0x23, -- downarrow - [0x02194] = 0x24, -- leftrightarrow - [0x02197] = 0x25, -- nearrow - [0x02198] = 0x26, -- searrow - [0x02243] = 0x27, -- simeq - [0x021D0] = 0x28, -- Leftarrow - [0x021D2] = 0x29, -- Rightarrow - [0x021D1] = 0x2A, -- Uparrow - [0x021D3] = 0x2B, -- Downarrow - [0x021D4] = 0x2C, -- Leftrightarrow - [0x02196] = 0x2D, -- nwarrow - [0x02199] = 0x2E, -- swarrow - [0x0221D] = 0x2F, -- propto - [0x02032] = 0x30, -- prime - [0x0221E] = 0x31, -- infty - [0x02208] = 0x32, -- in - [0x0220B] = 0x33, -- ni - [0x025B3] = 0x34, -- triangle, bigtriangleup - [0x025BD] = 0x35, -- bigtriangledown - [0x00338] = 0x36, -- not --- 0x37, -- (beginning of arrow) - [0x02200] = 0x38, -- forall - [0x02203] = 0x39, -- exists - [0x000AC] = 0x3A, -- neg, lnot - [0x02205] = 0x3B, -- empty set - [0x0211C] = 0x3C, -- Re - [0x02111] = 0x3D, -- Im - [0x022A4] = 0x3E, -- top - [0x022A5] = 0x3F, -- bot, perp - [0x02135] = 0x40, -- aleph - [0x1D49C] = 0x41, -- script A - [0x0212C] = 0x42, -- script B - [0x1D49E] = 0x43, -- script C - [0x1D49F] = 0x44, -- script D - [0x02130] = 0x45, -- script E - [0x02131] = 0x46, -- script F - [0x1D4A2] = 0x47, -- script G - [0x0210B] = 0x48, -- script H - [0x02110] = 0x49, -- script I - [0x1D4A5] = 0x4A, -- script J - [0x1D4A6] = 0x4B, -- script K - [0x02112] = 0x4C, -- script L - [0x02133] = 0x4D, -- script M - [0x1D4A9] = 0x4E, -- script N - [0x1D4AA] = 0x4F, -- script O - [0x1D4AB] = 0x50, -- script P - [0x1D4AC] = 0x51, -- script Q - [0x0211B] = 0x52, -- script R - [0x1D4AE] = 0x53, -- script S - [0x1D4AF] = 0x54, -- script T - [0x1D4B0] = 0x55, -- script U - [0x1D4B1] = 0x56, -- script V - [0x1D4B2] = 0x57, -- script W - [0x1D4B3] = 0x58, -- script X - [0x1D4B4] = 0x59, -- script Y - [0x1D4B5] = 0x5A, -- script Z - [0x0222A] = 0x5B, -- cup - [0x02229] = 0x5C, -- cap - [0x0228E] = 0x5D, -- uplus - [0x02227] = 0x5E, -- wedge, land - [0x02228] = 0x5F, -- vee, lor - [0x022A2] = 0x60, -- vdash - [0x022A3] = 0x61, -- dashv - [0x0230A] = 0x62, -- lfloor - [0x0230B] = 0x63, -- rfloor - [0x02308] = 0x64, -- lceil - [0x02309] = 0x65, -- rceil - [0x0007B] = 0x66, -- {, lbrace - [0x0007D] = 0x67, -- }, rbrace - [0x027E8] = 0x68, -- <, langle - [0x027E9] = 0x69, -- >, rangle - [0x0007C] = 0x6A, -- |, mid, lvert, rvert - [0x02225] = 0x6B, -- parallel - -- [0x02016] = 0x00, -- Vert, lVert, rVert, arrowvert, Arrowvert - [0x02195] = 0x6C, -- updownarrow - [0x021D5] = 0x6D, -- Updownarrow - [0x0005C] = 0x6E, -- \, backslash, setminus - [0x02216] = 0x6E, -- setminus - [0x02240] = 0x6F, -- wr - [0x0221A] = 0x70, -- sqrt. AM: Check surd?? - [0x02A3F] = 0x71, -- amalg - [0x1D6FB] = 0x72, -- nabla --- [0x0222B] = 0x73, -- smallint (TODO: what about intop?) - [0x02294] = 0x74, -- sqcup - [0x02293] = 0x75, -- sqcap - [0x02291] = 0x76, -- sqsubseteq - [0x02292] = 0x77, -- sqsupseteq - [0x000A7] = 0x78, -- S - [0x02020] = 0x79, -- dagger, dag - [0x02021] = 0x7A, -- ddagger, ddag - [0x000B6] = 0x7B, -- P - [0x02663] = 0x7C, -- clubsuit - [0x02662] = 0x7D, -- diamondsuit - [0x02661] = 0x7E, -- heartsuit - [0x02660] = 0x7F, -- spadesuit - [0xFE321] = 0x37, -- mapstochar - - [0xFE325] = 0x30, -- prime 0x02032 -} - --- The names in masm10.enc can be trusted best and are shown in the first --- column, while in the second column we show the tex/ams names. As usual --- it costs hours to figure out such a table. - -mathencodings["tex-ma"] = { - [0x022A1] = 0x00, -- squaredot \boxdot - [0x0229E] = 0x01, -- squareplus \boxplus - [0x022A0] = 0x02, -- squaremultiply \boxtimes - [0x025A1] = 0x03, -- square \square \Box - [0x025A0] = 0x04, -- squaresolid \blacksquare - [0x025AA] = 0x05, -- squaresmallsolid \centerdot - [0x022C4] = 0x06, -- diamond \Diamond \lozenge - [0x02666] = 0x07, -- diamondsolid \blacklozenge - [0x021BB] = 0x08, -- clockwise \circlearrowright - [0x021BA] = 0x09, -- anticlockwise \circlearrowleft - [0x021CC] = 0x0A, -- harpoonleftright \rightleftharpoons - [0x021CB] = 0x0B, -- harpoonrightleft \leftrightharpoons - [0x0229F] = 0x0C, -- squareminus \boxminus - [0x022A9] = 0x0D, -- forces \Vdash - [0x022AA] = 0x0E, -- forcesbar \Vvdash - [0x022A8] = 0x0F, -- satisfies \vDash - [0x021A0] = 0x10, -- dblarrowheadright \twoheadrightarrow - [0x0219E] = 0x11, -- dblarrowheadleft \twoheadleftarrow - [0x021C7] = 0x12, -- dblarrowleft \leftleftarrows - [0x021C9] = 0x13, -- dblarrowright \rightrightarrows - [0x021C8] = 0x14, -- dblarrowup \upuparrows - [0x021CA] = 0x15, -- dblarrowdwn \downdownarrows - [0x021BE] = 0x16, -- harpoonupright \upharpoonright \restriction - [0x021C2] = 0x17, -- harpoondownright \downharpoonright - [0x021BF] = 0x18, -- harpoonupleft \upharpoonleft - [0x021C3] = 0x19, -- harpoondownleft \downharpoonleft - [0x021A3] = 0x1A, -- arrowtailright \rightarrowtail - [0x021A2] = 0x1B, -- arrowtailleft \leftarrowtail - [0x021C6] = 0x1C, -- arrowparrleftright \leftrightarrows --- [0x021C5] = 0x00, -- \updownarrows (missing in lm) - [0x021C4] = 0x1D, -- arrowparrrightleft \rightleftarrows - [0x021B0] = 0x1E, -- shiftleft \Lsh - [0x021B1] = 0x1F, -- shiftright \Rsh - [0x021DD] = 0x20, -- squiggleright \leadsto \rightsquigarrow - [0x021AD] = 0x21, -- squiggleleftright \leftrightsquigarrow - [0x021AB] = 0x22, -- curlyleft \looparrowleft - [0x021AC] = 0x23, -- curlyright \looparrowright - [0x02257] = 0x24, -- circleequal \circeq - [0x0227F] = 0x25, -- followsorequal \succsim - [0x02273] = 0x26, -- greaterorsimilar \gtrsim - [0x02A86] = 0x27, -- greaterorapproxeql \gtrapprox - [0x022B8] = 0x28, -- multimap \multimap - [0x02234] = 0x29, -- therefore \therefore - [0x02235] = 0x2A, -- because \because - [0x02251] = 0x2B, -- equalsdots \Doteq \doteqdot - [0x0225C] = 0x2C, -- defines \triangleq - [0x0227E] = 0x2D, -- precedesorequal \precsim - [0x02272] = 0x2E, -- lessorsimilar \lesssim - [0x02A85] = 0x2F, -- lessorapproxeql \lessapprox - [0x02A95] = 0x30, -- equalorless \eqslantless - [0x02A96] = 0x31, -- equalorgreater \eqslantgtr - [0x022DE] = 0x32, -- equalorprecedes \curlyeqprec - [0x022DF] = 0x33, -- equalorfollows \curlyeqsucc - [0x0227C] = 0x34, -- precedesorcurly \preccurlyeq - [0x02266] = 0x35, -- lessdblequal \leqq - [0x02A7D] = 0x36, -- lessorequalslant \leqslant - [0x02276] = 0x37, -- lessorgreater \lessgtr - [0x02035] = 0x38, -- primereverse \backprime - -- [0x0] = 0x39, -- axisshort \dabar - [0x02253] = 0x3A, -- equaldotrightleft \risingdotseq - [0x02252] = 0x3B, -- equaldotleftright \fallingdotseq - [0x0227D] = 0x3C, -- followsorcurly \succcurlyeq - [0x02267] = 0x3D, -- greaterdblequal \geqq - [0x02A7E] = 0x3E, -- greaterorequalslant \geqslant - [0x02277] = 0x3F, -- greaterorless \gtrless - [0x0228F] = 0x40, -- squareimage \sqsubset - [0x02290] = 0x41, -- squareoriginal \sqsupset - -- wrong: see ** - -- [0x022B3] = 0x42, -- triangleright \rhd \vartriangleright - -- [0x022B2] = 0x43, -- triangleleft \lhd \vartriangleleft - -- cf lm - [0x022B5] = 0x44, -- trianglerightequal \unrhd \trianglerighteq - [0x022B4] = 0x45, -- triangleleftequal \unlhd \trianglelefteq - -- - [0x02605] = 0x46, -- star \bigstar - [0x0226C] = 0x47, -- between \between - [0x025BC] = 0x48, -- triangledownsld \blacktriangledown - [0x025B6] = 0x49, -- trianglerightsld \blacktriangleright - [0x025C0] = 0x4A, -- triangleleftsld \blacktriangleleft - -- [0x0] = 0x4B, -- arrowaxisright - -- [0x0] = 0x4C, -- arrowaxisleft - [0x025B2] = 0x4D, -- triangle \triangleup \vartriangle - [0x025B2] = 0x4E, -- trianglesolid \blacktriangle - [0x025BD] = 0x4F, -- triangleinv \triangledown - [0x02256] = 0x50, -- ringinequal \eqcirc - [0x022DA] = 0x51, -- lessequalgreater \lesseqgtr - [0x022DB] = 0x52, -- greaterlessequal \gtreqless - [0x02A8B] = 0x53, -- lessdbleqlgreater \lesseqqgtr - [0x02A8C] = 0x54, -- greaterdbleqlless \gtreqqless - [0x000A5] = 0x55, -- Yen \yen - [0x021DB] = 0x56, -- arrowtripleright \Rrightarrow - [0x021DA] = 0x57, -- arrowtripleleft \Lleftarrow - [0x02713] = 0x58, -- check \checkmark - [0x022BB] = 0x59, -- orunderscore \veebar - [0x022BC] = 0x5A, -- nand \barwedge - [0x02306] = 0x5B, -- perpcorrespond \doublebarwedge - [0x02220] = 0x5C, -- angle \angle - [0x02221] = 0x5D, -- measuredangle \measuredangle - [0x02222] = 0x5E, -- sphericalangle \sphericalangle - -- [0x0] = 0x5F, -- proportional \varpropto - -- [0x0] = 0x60, -- smile \smallsmile - -- [0x0] = 0x61, -- frown \smallfrown - [0x022D0] = 0x62, -- subsetdbl \Subset - [0x022D1] = 0x63, -- supersetdbl \Supset - [0x022D3] = 0x64, -- uniondbl \doublecup \Cup - [0x022D2] = 0x65, -- intersectiondbl \doublecap \Cap - [0x022CF] = 0x66, -- uprise \curlywedge - [0x022CE] = 0x67, -- downfall \curlyvee - [0x022CB] = 0x68, -- multiopenleft \leftthreetimes - [0x022CC] = 0x69, -- multiopenright \rightthreetimes - [0x02AC5] = 0x6A, -- subsetdblequal \subseteqq - [0x02AC6] = 0x6B, -- supersetdblequal \supseteqq - [0x0224F] = 0x6C, -- difference \bumpeq - [0x0224E] = 0x6D, -- geomequivalent \Bumpeq - [0x022D8] = 0x6E, -- muchless \lll \llless - [0x022D9] = 0x6F, -- muchgreater \ggg \gggtr - [0x0231C] = 0x70, -- rightanglenw \ulcorner - [0x0231D] = 0x71, -- rightanglene \urcorner - [0x024C7] = 0x72, -- circleR \circledR - [0x024C8] = 0x73, -- circleS \circledS - [0x022D4] = 0x74, -- fork \pitchfork - [0x02214] = 0x75, -- dotplus \dotplus - [0x0223D] = 0x76, -- revsimilar \backsim - [0x022CD] = 0x77, -- revasymptequal \backsimeq -- AM: Check this! I mapped it to simeq. - [0x0231E] = 0x78, -- rightanglesw \llcorner - [0x0231F] = 0x79, -- rightanglese \lrcorner - [0x02720] = 0x7A, -- maltesecross \maltese - [0x02201] = 0x7B, -- complement \complement - [0x022BA] = 0x7C, -- intercal \intercal - [0x0229A] = 0x7D, -- circlering \circledcirc - [0x0229B] = 0x7E, -- circleasterisk \circledast - [0x0229D] = 0x7F, -- circleminus \circleddash -} - -mathencodings["tex-mb"] = { - -- [0x0] = 0x00, -- lessornotequal \lvertneqq - -- [0x0] = 0x01, -- greaterornotequal \gvertneqq - [0x02270] = 0x02, -- notlessequal \nleq - [0x02271] = 0x03, -- notgreaterequal \ngeq - [0x0226E] = 0x04, -- notless \nless - [0x0226F] = 0x05, -- notgreater \ngtr - [0x02280] = 0x06, -- notprecedes \nprec - [0x02281] = 0x07, -- notfollows \nsucc - [0x02268] = 0x08, -- lessornotdbleql \lneqq - [0x02269] = 0x09, -- greaterornotdbleql \gneqq - -- [0x0] = 0x0A, -- notlessorslnteql \nleqslant - -- [0x0] = 0x0B, -- notgreaterorslnteql \ngeqslant - [0x02A87] = 0x0C, -- lessnotequal \lneq - [0x02A88] = 0x0D, -- greaternotequal \gneq - -- [0x0] = 0x0E, -- notprecedesoreql \npreceq - -- [0x0] = 0x0F, -- notfollowsoreql \nsucceq - [0x022E8] = 0x10, -- precedeornoteqvlnt \precnsim - [0x022E9] = 0x11, -- followornoteqvlnt \succnsim - [0x022E6] = 0x12, -- lessornotsimilar \lnsim - [0x022E7] = 0x13, -- greaterornotsimilar \gnsim - -- [0x0] = 0x14, -- notlessdblequal \nleqq - -- [0x0] = 0x15, -- notgreaterdblequal \ngeqq - [0x02AB5] = 0x16, -- precedenotslnteql \precneqq - [0x02AB6] = 0x17, -- follownotslnteql \succneqq - [0x02AB9] = 0x18, -- precedenotdbleqv \precnapprox - [0x02ABA] = 0x19, -- follownotdbleqv \succnapprox - [0x02A89] = 0x1A, -- lessnotdblequal \lnapprox - [0x02A8A] = 0x1B, -- greaternotdblequal \gnapprox - [0x02241] = 0x1C, -- notsimilar \nsim - [0x02247] = 0x1D, -- notapproxequal \ncong - -- [0x0] = 0x1E, -- upslope \diagup - -- [0x0] = 0x1F, -- downslope \diagdown - -- [0x0] = 0x20, -- notsubsetoreql \varsubsetneq - -- [0x0] = 0x21, -- notsupersetoreql \varsupsetneq - -- [0x0] = 0x22, -- notsubsetordbleql \nsubseteqq - -- [0x0] = 0x23, -- notsupersetordbleql \nsupseteqq - [0x02ACB] = 0x24, -- subsetornotdbleql \subsetneqq - [0x02ACC] = 0x25, -- supersetornotdbleql \supsetneqq - -- [0x0] = 0x26, -- subsetornoteql \varsubsetneqq - -- [0x0] = 0x27, -- supersetornoteql \varsupsetneqq - [0x0228A] = 0x28, -- subsetnoteql \subsetneq - [0x0228B] = 0x29, -- supersetnoteql \supsetneq - [0x02288] = 0x2A, -- notsubseteql \nsubseteq - [0x02289] = 0x2B, -- notsuperseteql \nsupseteq - [0x02226] = 0x2C, -- notparallel \nparallel - [0x02224] = 0x2D, -- notbar \nmid \ndivides - -- [0x0] = 0x2E, -- notshortbar \nshortmid - -- [0x0] = 0x2F, -- notshortparallel \nshortparallel - [0x022AC] = 0x30, -- notturnstile \nvdash - [0x022AE] = 0x31, -- notforces \nVdash - [0x022AD] = 0x32, -- notsatisfies \nvDash - [0x022AF] = 0x33, -- notforcesextra \nVDash - [0x022ED] = 0x34, -- nottriangeqlright \ntrianglerighteq - [0x022EC] = 0x35, -- nottriangeqlleft \ntrianglelefteq - [0x022EA] = 0x36, -- nottriangleleft \ntriangleleft - [0x022EB] = 0x37, -- nottriangleright \ntriangleright - [0x0219A] = 0x38, -- notarrowleft \nleftarrow - [0x0219B] = 0x39, -- notarrowright \nrightarrow - [0x021CD] = 0x3A, -- notdblarrowleft \nLeftarrow - [0x021CF] = 0x3B, -- notdblarrowright \nRightarrow - [0x021CE] = 0x3C, -- notdblarrowboth \nLeftrightarrow - [0x021AE] = 0x3D, -- notarrowboth \nleftrightarrow - [0x022C7] = 0x3E, -- dividemultiply \divideontimes - [0x02300] = 0x3F, -- diametersign \varnothing - [0x02204] = 0x40, -- notexistential \nexists - [0x1D538] = 0x41, -- A (blackboard A) - [0x1D539] = 0x42, -- B - [0x02102] = 0x43, -- C - [0x1D53B] = 0x44, -- D - [0x1D53C] = 0x45, -- E - [0x1D53D] = 0x46, -- F - [0x1D53E] = 0x47, -- G - [0x0210D] = 0x48, -- H - [0x1D540] = 0x49, -- I - [0x1D541] = 0x4A, -- J - [0x1D542] = 0x4B, -- K - [0x1D543] = 0x4C, -- L - [0x1D544] = 0x4D, -- M - [0x02115] = 0x4E, -- N - [0x1D546] = 0x4F, -- O - [0x02119] = 0x50, -- P - [0x0211A] = 0x51, -- Q - [0x0211D] = 0x52, -- R - [0x1D54A] = 0x53, -- S - [0x1D54B] = 0x54, -- T - [0x1D54C] = 0x55, -- U - [0x1D54D] = 0x56, -- V - [0x1D54E] = 0x57, -- W - [0x1D54F] = 0x58, -- X - [0x1D550] = 0x59, -- Y - [0x02124] = 0x5A, -- Z (blackboard Z) - [0x02132] = 0x60, -- finv \Finv - [0x02141] = 0x61, -- fmir \Game - -- [0x0] = 0x62, tildewide - -- [0x0] = 0x63, tildewider - -- [0x0] = 0x64, Finv - -- [0x0] = 0x65, Gmir - [0x02127] = 0x66, -- Omegainv \mho - [0x000F0] = 0x67, -- eth \eth - [0x02242] = 0x68, -- equalorsimilar \eqsim - [0x02136] = 0x69, -- beth \beth - [0x02137] = 0x6A, -- gimel \gimel - [0x02138] = 0x6B, -- daleth \daleth - [0x022D6] = 0x6C, -- lessdot \lessdot - [0x022D7] = 0x6D, -- greaterdot \gtrdot - [0x022C9] = 0x6E, -- multicloseleft \ltimes - [0x022CA] = 0x6F, -- multicloseright \rtimes - -- [0x0] = 0x70, -- barshort \shortmid - -- [0x0] = 0x71, -- parallelshort \shortparallel - -- [0x02216] = 0x72, -- integerdivide \smallsetminus (2216 already part of tex-sy - -- [0x0] = 0x73, -- similar \thicksim - -- [0x0] = 0x74, -- approxequal \thickapprox - [0x0224A] = 0x75, -- approxorequal \approxeq - [0x02AB8] = 0x76, -- followsorequal \succapprox - [0x02AB7] = 0x77, -- precedesorequal \precapprox - [0x021B6] = 0x78, -- archleftdown \curvearrowleft - [0x021B7] = 0x79, -- archrightdown \curvearrowright - [0x003DC] = 0x7A, -- Digamma \digamma - [0x003F0] = 0x7B, -- kappa \varkappa - [0x1D55C] = 0x7C, -- k \Bbbk (blackboard k) - [0x0210F] = 0x7D, -- planckover2pi \hslash - [0x00127] = 0x7E, -- planckover2pi1 \hbar - [0x003F6] = 0x7F, -- epsiloninv \backepsilon -} - -mathencodings["tex-mc"] = { - -- this file has no tfm so it gets mapped in the private space - [0xFE324] = "mapsfromchar", -} - -mathencodings["tex-fraktur"] = { --- [0x1D504] = 0x41, -- A (fraktur A) --- [0x1D505] = 0x42, -- B - [0x0212D] = 0x43, -- C --- [0x1D507] = 0x44, -- D --- [0x1D508] = 0x45, -- E --- [0x1D509] = 0x46, -- F --- [0x1D50A] = 0x47, -- G - [0x0210C] = 0x48, -- H - [0x02111] = 0x49, -- I --- [0x1D50D] = 0x4A, -- J --- [0x1D50E] = 0x4B, -- K --- [0x1D50F] = 0x4C, -- L --- [0x1D510] = 0x4D, -- M --- [0x1D511] = 0x4E, -- N --- [0x1D512] = 0x4F, -- O --- [0x1D513] = 0x50, -- P --- [0x1D514] = 0x51, -- Q - [0x0211C] = 0x52, -- R --- [0x1D516] = 0x53, -- S --- [0x1D517] = 0x54, -- T --- [0x1D518] = 0x55, -- U --- [0x1D519] = 0x56, -- V --- [0x1D51A] = 0x57, -- W --- [0x1D51B] = 0x58, -- X --- [0x1D51C] = 0x59, -- Y - [0x02128] = 0x5A, -- Z (fraktur Z) --- [0x1D51E] = 0x61, -- a (fraktur a) --- [0x1D51F] = 0x62, -- b --- [0x1D520] = 0x63, -- c --- [0x1D521] = 0x64, -- d --- [0x1D522] = 0x65, -- e --- [0x1D523] = 0x66, -- f --- [0x1D524] = 0x67, -- g --- [0x1D525] = 0x68, -- h --- [0x1D526] = 0x69, -- i --- [0x1D527] = 0x6A, -- j --- [0x1D528] = 0x6B, -- k --- [0x1D529] = 0x6C, -- l --- [0x1D52A] = 0x6D, -- m --- [0x1D52B] = 0x6E, -- n --- [0x1D52C] = 0x6F, -- o --- [0x1D52D] = 0x70, -- p --- [0x1D52E] = 0x71, -- q --- [0x1D52F] = 0x72, -- r --- [0x1D530] = 0x73, -- s --- [0x1D531] = 0x74, -- t --- [0x1D532] = 0x75, -- u --- [0x1D533] = 0x76, -- v --- [0x1D534] = 0x77, -- w --- [0x1D535] = 0x78, -- x --- [0x1D536] = 0x79, -- y --- [0x1D537] = 0x7A, -- z -} - --- now that all other vectors are defined ... - -vfmath.setletters(mathencodings, "tex-it", 0x1D434, 0x1D44E) -vfmath.setletters(mathencodings, "tex-ss", 0x1D5A0, 0x1D5BA) -vfmath.setletters(mathencodings, "tex-tt", 0x1D670, 0x1D68A) -vfmath.setletters(mathencodings, "tex-bf", 0x1D400, 0x1D41A) -vfmath.setletters(mathencodings, "tex-bi", 0x1D468, 0x1D482) -vfmath.setletters(mathencodings, "tex-fraktur", 0x1D504, 0x1D51E) -vfmath.setletters(mathencodings, "tex-fraktur-bold", 0x1D56C, 0x1D586) - -vfmath.setdigits (mathencodings, "tex-ss", 0x1D7E2) -vfmath.setdigits (mathencodings, "tex-tt", 0x1D7F6) -vfmath.setdigits (mathencodings, "tex-bf", 0x1D7CE) - --- vfmath.setdigits (mathencodings, "tex-bi", 0x1D7CE) - --- todo: add ss, tt, bf etc vectors --- todo: we can make ss tt etc an option diff --git a/tex/context/base/mult-aux.mkiv b/tex/context/base/mult-aux.mkiv index beb107e26..18cafd153 100644 --- a/tex/context/base/mult-aux.mkiv +++ b/tex/context/base/mult-aux.mkiv @@ -261,8 +261,8 @@ \let\definehandlerparent\empty -\unexpanded\def\mult_interfaces_install_define_handler#1#2#3#4#5#6#7#8#9% - {\ifx#4\relax\let#4\empty\fi +\unexpanded\def\mult_interfaces_install_define_handler#1#2#3#4#5#6#7#8#9% why is \expanded still needed in clones + {\ifx#4\relax\let#4\empty\fi % see \defineregister \unexpanded\def#2{\dotripleempty#5}% \newtoks#6% \newtoks#7% diff --git a/tex/context/base/mult-def.lua b/tex/context/base/mult-def.lua index 4f402e6fb..26b2b8529 100644 --- a/tex/context/base/mult-def.lua +++ b/tex/context/base/mult-def.lua @@ -3,7 +3,8 @@ if not modules then modules = { } end modules ['mult-def'] = { comment = "companion to mult-ini.mkiv", author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files" + license = "see context related readme files", + dataonly = true, } return { diff --git a/tex/context/base/mult-ini.lua b/tex/context/base/mult-ini.lua index ddd98caf1..8d0d34ba4 100644 --- a/tex/context/base/mult-ini.lua +++ b/tex/context/base/mult-ini.lua @@ -45,7 +45,7 @@ local currentresponse = storage.shared.currentresponse local complete = allocate() interfaces.complete = complete -local function resolve(t,k) -- one access needed to get loaded +local function resolve(t,k) -- one access needed to get loaded (not stored!) report_interface("loading interface definitions from 'mult-def.lua'") complete = dofile(resolvers.findfile("mult-def.lua")) report_interface("loading interface messages from 'mult-mes.lua'") diff --git a/tex/context/base/mult-mes.lua b/tex/context/base/mult-mes.lua index 473c86d35..68a392190 100644 --- a/tex/context/base/mult-mes.lua +++ b/tex/context/base/mult-mes.lua @@ -3,7 +3,8 @@ if not modules then modules = { } end modules ['mult-mes'] = { comment = "companion to mult-ini.mkiv", author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files" + license = "see context related readme files", + dataonly = true, } -- floatsblocks -> floats diff --git a/tex/context/base/node-dir.lua b/tex/context/base/node-dir.lua index 970313d96..6ee5cd4b8 100644 --- a/tex/context/base/node-dir.lua +++ b/tex/context/base/node-dir.lua @@ -1,4 +1,4 @@ -if not modules then modules = { } end modules ['node-mir'] = { +if not modules then modules = { } end modules ['node-dir'] = { version = 1.001, comment = "companion to node-ini.mkiv", author = "Taco Hoekwater and Hans Hagen", diff --git a/tex/context/base/node-ref.lua b/tex/context/base/node-ref.lua index d5fa7fa01..2896c0d67 100644 --- a/tex/context/base/node-ref.lua +++ b/tex/context/base/node-ref.lua @@ -1,6 +1,6 @@ -if not modules then modules = { } end modules ['node-bck'] = { +if not modules then modules = { } end modules ['node-ref'] = { version = 1.001, - comment = "companion to node-bck.mkiv", + comment = "companion to node-ref.mkiv", author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", copyright = "PRAGMA ADE / ConTeXt Development Team", license = "see context related readme files" diff --git a/tex/context/base/page-ins.lua b/tex/context/base/page-ins.lua index 44de95ea1..fd9d9e024 100644 --- a/tex/context/base/page-ins.lua +++ b/tex/context/base/page-ins.lua @@ -1,4 +1,4 @@ -if not modules then modules = { } end modules ['page-mix'] = { +if not modules then modules = { } end modules ['page-ins'] = { version = 1.001, comment = "companion to page-mix.mkiv", author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", diff --git a/tex/context/base/page-mix.lua b/tex/context/base/page-mix.lua index 55b00e68f..91e1f0755 100644 --- a/tex/context/base/page-mix.lua +++ b/tex/context/base/page-mix.lua @@ -379,6 +379,8 @@ return false break end else + -- todo: nobreak etc ... we might need to backtrack so we need to remember + -- the last acceptable break -- club and widow and such i.e. resulting penalties (if we care) end end diff --git a/tex/context/base/scrn-ini.lua b/tex/context/base/scrn-ini.lua index 2836362df..8fe1e0cae 100644 --- a/tex/context/base/scrn-ini.lua +++ b/tex/context/base/scrn-ini.lua @@ -1,4 +1,4 @@ -if not modules then modules = { } end modules ['scrn-int'] = { +if not modules then modules = { } end modules ['scrn-ini'] = { version = 1.001, comment = "companion to scrn-int.mkiv", author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", diff --git a/tex/context/base/scrn-ref.lua b/tex/context/base/scrn-ref.lua index 0b1dff2c1..df71b6a97 100644 --- a/tex/context/base/scrn-ref.lua +++ b/tex/context/base/scrn-ref.lua @@ -1,4 +1,4 @@ -if not modules then modules = { } end modules ['scrn-int'] = { +if not modules then modules = { } end modules ['scrn-ref'] = { version = 1.001, comment = "companion to scrn-int.mkiv", author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", diff --git a/tex/context/base/sort-lan.lua b/tex/context/base/sort-lan.lua index 6a0cb8eab..be3a669b6 100644 --- a/tex/context/base/sort-lan.lua +++ b/tex/context/base/sort-lan.lua @@ -3,7 +3,8 @@ if not modules then modules = { } end modules ['sort-lan'] = { comment = "companion to sort-lan.mkiv", author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files" + license = "see context related readme files", + dataonly = true, } -- Many vectors were supplied by Wolfgang Schuster and Philipp diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf index be3417a1a..5b66e2e1f 100644 Binary files a/tex/context/base/status-files.pdf and b/tex/context/base/status-files.pdf differ diff --git a/tex/context/base/status-lua.pdf b/tex/context/base/status-lua.pdf index ce3356446..378d9be23 100644 Binary files a/tex/context/base/status-lua.pdf and b/tex/context/base/status-lua.pdf differ diff --git a/tex/context/base/strc-reg.mkiv b/tex/context/base/strc-reg.mkiv index d377e0736..3940594c3 100644 --- a/tex/context/base/strc-reg.mkiv +++ b/tex/context/base/strc-reg.mkiv @@ -131,8 +131,9 @@ \setuevalue{\e!place\currentregister}{\placeregister[\currentregister]}% \setuevalue{\e!complete\currentregister}{\completeregister[\currentregister]}% \setuevalue{\e!setup\currentregister\e!endsetup}{\setupregister[\currentregister]}% - \dorecurse\plusthree {% - \defineregister[\currentregister:\recurselevel][\currentregister]% + \dorecurse\plusthree {% weird, expanded should not be needed + \normalexpanded{\defineregister[\currentregister:\recurselevel][\currentregister]}% +% \defineregister[\currentregister:\recurselevel][\currentregister]% \letregisterparameter{\c!entries:\recurselevel}\empty % needed as we use detokenize (ok, we can \letregisterparameter{\c!keys :\recurselevel}\empty % avoid it, but it's faster too) }% @@ -623,6 +624,7 @@ \fi \registerparameter\c!command{#1}% \endgroup + \blank[\v!samepage]% \registerparameter\c!after \par \nobreak} diff --git a/tex/context/base/strc-syn.lua b/tex/context/base/strc-syn.lua index c2b5251d0..ca4b3ac18 100644 --- a/tex/context/base/strc-syn.lua +++ b/tex/context/base/strc-syn.lua @@ -1,4 +1,4 @@ -if not modules then modules = { } end modules ['str-syn'] = { +if not modules then modules = { } end modules ['strc-syn'] = { version = 1.001, comment = "companion to str-syn.mkiv", author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", diff --git a/tex/context/base/trac-tex.lua b/tex/context/base/trac-tex.lua index 7920bd1cb..362a1dd67 100644 --- a/tex/context/base/trac-tex.lua +++ b/tex/context/base/trac-tex.lua @@ -1,4 +1,4 @@ -if not modules then modules = { } end modules ['trac-hsh'] = { +if not modules then modules = { } end modules ['trac-tex'] = { version = 1.001, comment = "companion to trac-deb.mkiv", author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", diff --git a/tex/context/base/util-lua.lua b/tex/context/base/util-lua.lua index b49e93beb..879ce7f79 100644 --- a/tex/context/base/util-lua.lua +++ b/tex/context/base/util-lua.lua @@ -2,36 +2,178 @@ if not modules then modules = { } end modules ['util-lua'] = { version = 1.001, comment = "companion to luat-lib.mkiv", author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + comment = "the strip code is written by Peter Cawley", copyright = "PRAGMA ADE / ConTeXt Development Team", license = "see context related readme files" } -utilities = utilities or {} -utilities.lua = utilities.lua or { } -utilities.report = logs and logs.reporter("system") or print +local rep, sub, byte, dump = string.rep, string.sub, string.byte, string.dump +local loadstring, loadfile = loadstring, loadfile -local function stupidcompile(luafile,lucfile) +utilities = utilities or {} +utilities.lua = utilities.lua or { } +local luautilities = utilities.lua + +utilities.report = logs and logs.reporter("system") or print + +local tracestripping = false +local forcestupidcompile = true +luautilities.stripcode = true +luautilities.nofstrippedchunks = 0 +luautilities.nofstrippedbytes = 0 + +-- The next function was posted by Peter Cawley on the lua list and strips line +-- number information etc. from the bytecode data blob. We only apply this trick +-- when we store data tables. Stripping makes the compressed format file about +-- 1MB smaller (and uncompressed we save at least 6MB). +-- +-- You can consider this feature an experiment, so it might disappear. There is +-- no noticeable gain in runtime although the memory footprint should be somewhat +-- smaller (and the file system has a bit less to deal with). +-- +-- Begin of borrowed code ... works for Lua 5.1 which LuaTeX currently uses ... + +local function strip_code_pc(dump,name) + local before = #dump + local version, format, endian, int, size, ins, num = byte(dump,5,11) + local subint + if endian == 1 then + subint = function(dump, i, l) + local val = 0 + for n = l, 1, -1 do + val = val * 256 + byte(dump,i + n - 1) + end + return val, i + l + end + else + subint = function(dump, i, l) + local val = 0 + for n = 1, l, 1 do + val = val * 256 + byte(dump,i + n - 1) + end + return val, i + l + end + end + local strip_function + strip_function = function(dump) + local count, offset = subint(dump, 1, size) + local stripped, dirty = rep("\0", size), offset + count + offset = offset + count + int * 2 + 4 + offset = offset + int + subint(dump, offset, int) * ins + count, offset = subint(dump, offset, int) + for n = 1, count do + local t + t, offset = subint(dump, offset, 1) + if t == 1 then + offset = offset + 1 + elseif t == 4 then + offset = offset + size + subint(dump, offset, size) + elseif t == 3 then + offset = offset + num + end + end + count, offset = subint(dump, offset, int) + stripped = stripped .. sub(dump,dirty, offset - 1) + for n = 1, count do + local proto, off = strip_function(sub(dump,offset, -1)) + stripped, offset = stripped .. proto, offset + off - 1 + end + offset = offset + subint(dump, offset, int) * int + int + count, offset = subint(dump, offset, int) + for n = 1, count do + offset = offset + subint(dump, offset, size) + size + int * 2 + end + count, offset = subint(dump, offset, int) + for n = 1, count do + offset = offset + subint(dump, offset, size) + size + end + stripped = stripped .. rep("\0", int * 3) + return stripped, offset + end + dump = sub(dump,1,12) .. strip_function(sub(dump,13,-1)) + local after = #dump + local delta = before-after + if tracestripping then + utilities.report("stripped bytecode: %s, before %s, after %s, delta %s",name or "unknown",before,after,delta) + end + luautilities.nofstrippedchunks = luautilities.nofstrippedchunks + 1 + luautilities.nofstrippedbytes = luautilities.nofstrippedbytes + delta + return dump, delta +end + +-- ... end of borrowed code. + +local function strippedbytecode(code,forcestrip,name) + if forcestrip and luautilities.stripcode then + return strip_code_pc(code,name) + else + return code, 0 + end +end + +luautilities.stripbytecode = strip_code_pc +luautilities.strippedbytecode = strippedbytecode + +function luautilities.loadedluacode(fullname,forcestrip,name) + -- quite subtle ... doing this wrong incidentally can give more bytes + local code = loadfile(fullname) + if code then + code() + end + if forcestrip and luautilities.stripcode then + if type(forcestrip) == "function" then + forcestrip = forcestrip(fullname) + end + if forcestrip then + local code, n = strip_code_pc(dump(code,name or fullname)) + return loadstring(code), n + else + return code, 0 + end + else + return code, 0 + end +end + +function luautilities.strippedloadstring(str,forcestrip,name) -- better inline + if forcestrip and luautilities.stripcode then + local code, n = strip_code_pc(dump(loadstring(str)),name) + return loadstring(code), n + else + return loadstring(str) + end +end + +local function stupidcompile(luafile,lucfile,strip) local data = io.loaddata(luafile) if data and data ~= "" then - data = string.dump(data) + data = dump(loadstring(data)) + if strip then + data = strippedbytecode(data,true,luafile) -- last one is reported + end if data and data ~= "" then io.savedata(lucfile,data) end end end -function utilities.lua.compile(luafile,lucfile,cleanup,strip,fallback) -- defaults: cleanup=false strip=true +function luautilities.compile(luafile,lucfile,cleanup,strip,fallback) -- defaults: cleanup=false strip=true utilities.report("lua: compiling %s into %s",luafile,lucfile) os.remove(lucfile) - local command = "-o " .. string.quoted(lucfile) .. " " .. string.quoted(luafile) - if strip ~= false then - command = "-s " .. command + local done = false + if forcestupidcompile then + fallback = true + else + local command = "-o " .. string.quoted(lucfile) .. " " .. string.quoted(luafile) + if strip ~= false then + command = "-s " .. command + end + done = os.spawn("texluac " .. command) == 0 -- or os.spawn("luac " .. command) == 0 end - local done = os.spawn("texluac " .. command) == 0 -- or os.spawn("luac " .. command) == 0 if not done and fallback then utilities.report("lua: dumping %s into %s (unstripped)",luafile,lucfile) - stupidcompile(luafile,lucfile) -- maybe use the stripper we have elsewhere - cleanup = false -- better see how worse it is + stupidcompile(luafile,lucfile,strip) + cleanup = false -- better see how bad it is end if done and cleanup == true and lfs.isfile(lucfile) and lfs.isfile(luafile) then utilities.report("lua: removing %s",luafile) @@ -44,11 +186,11 @@ end --~ local types = { } ---~ function utilities.lua.registerdatatype(d,name) +--~ function luautilities.registerdatatype(d,name) --~ types[getmetatable(d)] = name --~ end ---~ function utilities.lua.datatype(d) +--~ function luautilities.datatype(d) --~ local t = type(d) --~ if t == "userdata" then --~ local m = getmetatable(d) @@ -58,6 +200,6 @@ end --~ end --~ end ---~ utilities.lua.registerdatatype(lpeg.P("!"),"lpeg") +--~ luautilities.registerdatatype(lpeg.P("!"),"lpeg") ---~ print(utilities.lua.datatype(lpeg.P("oeps"))) +--~ print(luautilities.datatype(lpeg.P("oeps"))) diff --git a/tex/context/base/x-mathml.mkiv b/tex/context/base/x-mathml.mkiv index f80e5b18c..2fb5fb58a 100644 --- a/tex/context/base/x-mathml.mkiv +++ b/tex/context/base/x-mathml.mkiv @@ -17,6 +17,9 @@ % xml, tex and lua. I could rewrite the lot but it also shows how context evolves. % % no m:text strip (needs checking, maybe nbsp is mandate +% +% todo: more will be moved to lua (less hassle) +% todo: move left/right to the lua end \writestatus{loading}{ConTeXt XML Macros / MathML Renderer} @@ -32,13 +35,13 @@ \def\ctxmodulemathml#1{\directlua\zerocount{moduledata.mathml.#1}} \startxmlsetups xml:mml:define - \xmlsetsetup{\xmldocument} {(formula|subformula)} {mml:formula} - \xmlfilter {\xmldocument} {omt:*/function(remapopenmath)} - \xmlfilter {\xmldocument} {mml:bind/function(remapmmlbind)} - \xmlfilter {\xmldocument} {mml:csymbol/function(remapmmlcsymbol)} - \xmlsetsetup{\xmldocument} {mml:*} {mml:*} - \xmlsetsetup{\xmldocument} {mml:apply/mml:apply/mml:inverse/../..} {mml:apply:inverse} - \xmlstrip {\xmldocument} {(mml:mi|mml:mo|mml:mn|mml:csymbol)} + \xmlsetsetup{#1} {(formula|subformula)} {mml:formula} + \xmlfilter {#1} {omt:*/function(remapopenmath)} + \xmlfilter {#1} {mml:bind/function(remapmmlbind)} + \xmlfilter {#1} {mml:csymbol/function(remapmmlcsymbol)} + \xmlsetsetup{#1} {mml:*} {mml:*} + \xmlsetsetup{#1} {mml:apply/mml:apply/mml:inverse/../..} {mml:apply:inverse} + \xmlstrip {#1} {(mml:mi|mml:mo|mml:mn|mml:csymbol)} \stopxmlsetups \xmlregisterns{omt}{openmath} diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 2fe9e3e29..fb3d0fe82 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/21/12 16:50:19 +-- merge date : 07/23/12 20:18:32 do -- begin closure to overcome local limits and interference -- cgit v1.2.3