summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/luatex/luamplib
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/luatex/luamplib')
-rw-r--r--Master/texmf-dist/tex/luatex/luamplib/luamplib.lua21
-rw-r--r--Master/texmf-dist/tex/luatex/luamplib/luamplib.sty7
2 files changed, 18 insertions, 10 deletions
diff --git a/Master/texmf-dist/tex/luatex/luamplib/luamplib.lua b/Master/texmf-dist/tex/luatex/luamplib/luamplib.lua
index 430d2991efa..a0bdce00e70 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.21.1",
- date = "2021/11/23",
+ version = "2.22.0",
+ date = "2022/01/09",
description = "Lua package to typeset Metapost with LuaTeX's MPLib.",
}
@@ -346,11 +346,18 @@ end
luamplib.codeinherit = false
local mplibinstances = {}
-local function process (data)
- local standalone = not luamplib.codeinherit
- local currfmt = currentformat .. (luamplib.numbersystem or "scaled")
+local function process (data, instancename)
+ local defaultinstancename = currentformat .. (luamplib.numbersystem or "scaled")
.. tostring(luamplib.textextlabel) .. tostring(luamplib.legacy_verbatimtex)
+ local currfmt = instancename or defaultinstancename
+ if #currfmt == 0 then
+ currfmt = defaultinstancename
+ end
local mpx = mplibinstances[currfmt]
+ local standalone = false
+ if currfmt == defaultinstancename then
+ standalone = not luamplib.codeinherit
+ end
if mpx and standalone then
mpx:finish()
end
@@ -635,7 +642,7 @@ local function unprotect_expansion (str)
end
end
-local function process_mplibcode (data)
+local function process_mplibcode (data, instancename)
legacy_mplibcode_reset()
local everymplib = texgettoks'everymplibtoks' or ''
@@ -675,7 +682,7 @@ local function process_mplibcode (data)
end)
end
- process(data)
+ process(data, instancename)
end
luamplib.process_mplibcode = process_mplibcode
diff --git a/Master/texmf-dist/tex/luatex/luamplib/luamplib.sty b/Master/texmf-dist/tex/luatex/luamplib/luamplib.sty
index 8d91224481f..5de8c9c6b36 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}
- [2021/11/23 v2.21.1 mplib package for LuaTeX]
+ [2022/01/09 v2.22.0 mplib package for LuaTeX]
\ifx\newluafunction\@undefined
\input ltluatex
\fi
@@ -62,7 +62,8 @@
\endgroup
}
\else
-\newenvironment{mplibcode}{%
+\newenvironment{mplibcode}[1][]{%
+ \global\def\currentmpinstancename{#1}%
\mplibtmptoks{}\ltxdomplibcode
}{}
\def\ltxdomplibcode{%
@@ -76,7 +77,7 @@
\mplibtmptoks\expandafter{\the\mplibtmptoks#1}%
\def\mplibtemp@a{#2}%
\ifx\mplib@mplibcode\mplibtemp@a
- \directlua{luamplib.process_mplibcode([===[\the\mplibtmptoks]===])}%
+ \directlua{luamplib.process_mplibcode([===[\the\mplibtmptoks]===],"\currentmpinstancename")}%
\end{mplibcode}%
\else
\mplibtmptoks\expandafter{\the\mplibtmptoks\end{#2}}%