diff options
Diffstat (limited to 'Master/texmf-dist/tex/luatex')
-rw-r--r-- | Master/texmf-dist/tex/luatex/luamplib/luamplib.lua | 29 | ||||
-rw-r--r-- | Master/texmf-dist/tex/luatex/luamplib/luamplib.sty | 18 |
2 files changed, 35 insertions, 12 deletions
diff --git a/Master/texmf-dist/tex/luatex/luamplib/luamplib.lua b/Master/texmf-dist/tex/luatex/luamplib/luamplib.lua index 0d2cc763dad..e2be1fae2b6 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.26.0", - date = "2024/03/01", + version = "2.26.2", + date = "2024/03/04", description = "Lua package to typeset Metapost with LuaTeX's MPLib.", } @@ -395,16 +395,30 @@ local function process_tex_text (str) return "" end -local mplibcolor_fmt = [[\begingroup\let\XC@mcolor\relax]].. +local mplibcolorfmt = { + xcolor = [[\begingroup\let\XC@mcolor\relax]].. [[\def\set@color{\global\mplibtmptoks\expandafter{\current@color}}]].. - [[\color %s \endgroup]] + [[\color %s\endgroup]], + l3color = [[\begingroup\color_if_exist:nTF %s]].. + [[{\def\__color_select:N #1{\expandafter\__color_select:nn #1}]].. + [[\def\__color_backend_select:nn #1#2{\global\mplibtmptoks{#1~#2}}]].. + [[\color_select:n %s}]].. + [[{\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(mplibcolor_fmt:format(str), catat11) + local myfmt = luamplib.cctabexplat and mplibcolorfmt.l3color or mplibcolorfmt.xcolor + local mod = str:match("(.-){.*}") + if mod and mod ~= "" then + myfmt = mplibcolorfmt.xcolor + end + run_tex_code(myfmt:format(str,str,str), luamplib.cctabexplat or catat11) return format('1 withprescript "MPlibOverrideColor=%s"', texgettoks"mplibtmptoks") end return "" @@ -462,6 +476,7 @@ mp = mp or {} local mp = mp mp.mf_path_reset = mp.mf_path_reset or function() end mp.mf_finish_saving_data = mp.mf_finish_saving_data or function() end +mp.report = mp.report or info catcodes = catcodes or {} local catcodes = catcodes @@ -653,10 +668,6 @@ local function process_mplibcode (data, instancename) data = format("\n%s\n%s\n%s\n",everymplib, data, everyendmplib) data = data:gsub("\r","\n") - data = data:gsub("\\mpcolor%s+(.-%b{})","mplibcolor(\"%1\")") - data = data:gsub("\\mpdim%s+(%b{})", "mplibdimen(\"%1\")") - data = data:gsub("\\mpdim%s+(\\%a+)","mplibdimen(\"%1\")") - data = data:gsub(btex_etex, function(str) return format("btex %s etex ", -- space luamplib.verbatiminput and str or protect_expansion(str)) diff --git a/Master/texmf-dist/tex/luatex/luamplib/luamplib.sty b/Master/texmf-dist/tex/luatex/luamplib/luamplib.sty index d2810d80e9c..10c267429ac 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} - [2024/03/01 v2.26.0 mplib package for LuaTeX] + [2024/03/04 v2.26.2 mplib package for LuaTeX] \ifx\newluafunction\@undefined \input ltluatex \fi @@ -147,9 +147,21 @@ }% } \fi -\def\mpdim#1{ mplibdimen("#1") } +\def\mpdim#1{ runscript("luamplibdimen{#1}") } +\ifdefined\IfDocumentMetadataTF + \IfDocumentMetadataTF{ + \newcatcodetable\catcodetable@explat + \directlua{ luamplib.cctabexplat = \the\allocationnumber } + \begingroup + \ExplSyntaxOn + \catcode`@=11 + \savecatcodetable\catcodetable@explat + \ExplSyntaxOff + \endgroup + }{} +\fi \def\mpcolor#1#{\domplibcolor{#1}} -\def\domplibcolor#1#2{ mplibcolor("#1{#2}") } +\def\domplibcolor#1#2{ runscript("luamplibcolor{#1{#2}}") } \def\mplibnumbersystem#1{\directlua{ local t = "#1" if t == "binary" then t = "decimal" end |