summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/luatex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2019-10-11 21:33:34 +0000
committerKarl Berry <karl@freefriends.org>2019-10-11 21:33:34 +0000
commit253f0f12cb645ea1458b36bd24f863e67406f688 (patch)
tree0521d74d026b31107d4022e6a6750a210d327016 /Master/texmf-dist/tex/luatex
parent98ef842ac8b0bc51c8a31937d1b76d3d3e98c8eb (diff)
luamplib (11oct19)
git-svn-id: svn://tug.org/texlive/trunk@52345 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/luatex')
-rw-r--r--Master/texmf-dist/tex/luatex/luamplib/luamplib.lua43
-rw-r--r--Master/texmf-dist/tex/luatex/luamplib/luamplib.sty2
2 files changed, 24 insertions, 21 deletions
diff --git a/Master/texmf-dist/tex/luatex/luamplib/luamplib.lua b/Master/texmf-dist/tex/luatex/luamplib/luamplib.lua
index bf4603cdeca..ac47afc42b3 100644
--- a/Master/texmf-dist/tex/luatex/luamplib/luamplib.lua
+++ b/Master/texmf-dist/tex/luatex/luamplib/luamplib.lua
@@ -11,8 +11,8 @@
luatexbase.provides_module {
name = "luamplib",
- version = "2.20.1",
- date = "2019/03/26",
+ version = "2.20.2",
+ date = "2019/10/11",
description = "Lua package to typeset Metapost with LuaTeX's MPLib.",
}
@@ -354,6 +354,10 @@ end
local tex_box_id = 2047
local factor = 65536*(7227/7200)
+local textext_fmt = [[image(addto currentpicture doublepath unitsquare ]]..
+ [[xscaled %f yscaled %f shifted (0,-%f) ]]..
+ [[withprescript "mplibtexboxid=%i:%f:%f")]]
+
local function process_tex_text (str)
if str then
tex_box_id = tex_box_id + 1
@@ -363,23 +367,22 @@ local function process_tex_text (str)
local wd = box.width / factor
local ht = box.height / factor
local dp = box.depth / factor
- return format("image(addto currentpicture doublepath unitsquare "..
- "xscaled %f yscaled %f shifted (0,-%f) "..
- "withprescript \"mplibtexboxid=%i:%f:%f\")",
- wd, ht+dp, dp, tex_box_id, wd, ht+dp)
+ return textext_fmt:format(wd, ht+dp, dp, tex_box_id, wd, ht+dp)
end
return ""
end
+local mplibcolor_fmt = [[\begingroup\let\XC@mcolor\relax]]..
+ [[\def\set@color{\global\mplibtmptoks\expandafter{\current@color}}]]..
+ [[\color %s \endgroup]]
+
local function process_color (str)
if str then
if not str:find("{.-}") then
str = format("{%s}",str)
end
- run_tex_code(format(
- "\\def\\set@color{\\toks0\\expandafter{\\current@color}}\\color %s", str),
- catat11)
- return format("1 withprescript \"MPlibOverrideColor=%s\"", texgettoks(0))
+ run_tex_code(mplibcolor_fmt:format(str), catat11)
+ return format('1 withprescript "MPlibOverrideColor=%s"', texgettoks"mplibtmptoks")
end
return ""
end
@@ -387,8 +390,8 @@ end
local function process_dimen (str)
if str then
str = str:gsub("{(.+)}","%1")
- run_tex_code(format("\\toks0\\expandafter{\\the\\dimexpr %s\\relax}", str))
- return format("begingroup %s endgroup", texgettoks(0))
+ run_tex_code(format([[\mplibtmptoks\expandafter{\the\dimexpr %s\relax}]], str))
+ return format("begingroup %s endgroup", texgettoks"mplibtmptoks")
end
return ""
end
@@ -418,7 +421,7 @@ end
local function process_verbatimtex_infig (str)
if str then
- return format("special \"postmplibverbtex=%s\";", str)
+ return format('special "postmplibverbtex=%s";', str)
end
return ""
end
@@ -599,8 +602,8 @@ end
local function process_mplibcode (data)
legacy_mplibcode_reset()
- local everymplib = texgettoks('everymplibtoks') or ''
- local everyendmplib = texgettoks('everyendmplibtoks') or ''
+ local everymplib = texgettoks'everymplibtoks' or ''
+ local everyendmplib = texgettoks'everyendmplibtoks' or ''
data = format("\n%s\n%s\n%s\n",everymplib, data, everyendmplib)
data = data:gsub("\r","\n")
@@ -620,8 +623,8 @@ local function process_mplibcode (data)
if not luamplib.verbatiminput then
data = data:gsub("\".-\"", protect_expansion)
data = data:gsub("%%.-\n","")
- run_tex_code(format("\\toks0\\expanded{{%s}}",data))
- data = texgettoks(0)
+ run_tex_code(format("\\mplibtmptoks\\expanded{{%s}}",data))
+ data = texgettoks"mplibtmptoks"
data = data:gsub("##", "#")
data = data:gsub("\".-\"", unprotect_expansion)
data = data:gsub(btex_etex, function(str)
@@ -637,9 +640,9 @@ end
luamplib.process_mplibcode = process_mplibcode
local further_split_keys = {
- ["mplibtexboxid"] = true,
- ["sh_color_a"] = true,
- ["sh_color_b"] = true,
+ mplibtexboxid = true,
+ sh_color_a = true,
+ sh_color_b = true,
}
local function script2table(s)
diff --git a/Master/texmf-dist/tex/luatex/luamplib/luamplib.sty b/Master/texmf-dist/tex/luatex/luamplib/luamplib.sty
index 8fed794485a..6849c6cf90f 100644
--- a/Master/texmf-dist/tex/luatex/luamplib/luamplib.sty
+++ b/Master/texmf-dist/tex/luatex/luamplib/luamplib.sty
@@ -14,7 +14,7 @@
\else
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{luamplib}
- [2019/03/26 v2.20.1 mplib package for LuaTeX]
+ [2019/10/11 v2.20.2 mplib package for LuaTeX]
\ifx\newluafunction\@undefined
\input ltluatex
\fi