texlive[52345] Master/texmf-dist: luamplib (11oct19)

commits+karl at tug.org commits+karl at tug.org
Fri Oct 11 23:33:34 CEST 2019


Revision: 52345
          http://tug.org/svn/texlive?view=revision&revision=52345
Author:   karl
Date:     2019-10-11 23:33:34 +0200 (Fri, 11 Oct 2019)
Log Message:
-----------
luamplib (11oct19)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/luatex/luamplib/NEWS
    trunk/Master/texmf-dist/doc/luatex/luamplib/luamplib.pdf
    trunk/Master/texmf-dist/source/luatex/luamplib/luamplib.dtx
    trunk/Master/texmf-dist/tex/luatex/luamplib/luamplib.lua
    trunk/Master/texmf-dist/tex/luatex/luamplib/luamplib.sty

Modified: trunk/Master/texmf-dist/doc/luatex/luamplib/NEWS
===================================================================
--- trunk/Master/texmf-dist/doc/luatex/luamplib/NEWS	2019-10-11 21:33:17 UTC (rev 52344)
+++ trunk/Master/texmf-dist/doc/luatex/luamplib/NEWS	2019-10-11 21:33:34 UTC (rev 52345)
@@ -1,5 +1,8 @@
                        History of the luamplib package
 
+2019/10/11 2.20.2
+    * fix issue #84 (pgf package hinders \mpcolor process)
+
 2019/03/26 2.20.1
     * '\mpdim' and '\mpcolor' are allowed, even if '\mplibverbatim' is enabled.
 

Modified: trunk/Master/texmf-dist/doc/luatex/luamplib/luamplib.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/source/luatex/luamplib/luamplib.dtx
===================================================================
--- trunk/Master/texmf-dist/source/luatex/luamplib/luamplib.dtx	2019-10-11 21:33:17 UTC (rev 52344)
+++ trunk/Master/texmf-dist/source/luatex/luamplib/luamplib.dtx	2019-10-11 21:33:34 UTC (rev 52345)
@@ -85,7 +85,7 @@
 %<*driver>
 \NeedsTeXFormat{LaTeX2e}
 \ProvidesFile{luamplib.drv}%
-  [2019/03/26 v2.20.1 Interface for using the mplib library]%
+  [2019/10/11 v2.20.2 Interface for using the mplib library]%
 \documentclass{ltxdoc}
 \usepackage{metalogo,multicol,mdwlist,fancyvrb,xspace}
 \usepackage[x11names]{xcolor}
@@ -101,7 +101,7 @@
     citecolor=\primarycolor,
      pdftitle={The luamplib package},
    pdfsubject={Interface for using the mplib library},
-    pdfauthor={Hans Hagen, Taco Hoekwater, Elie Roux, Philipp Gesang & Kim Dohyun},
+    pdfauthor={Hans Hagen, Taco Hoekwater, Elie Roux, Philipp Gesang \& Kim Dohyun},
   pdfkeywords={luatex, lualatex, mplib, metapost}
 ]{hyperref}
 \usepackage{fontspec}
@@ -153,7 +153,7 @@
 % \author{Hans Hagen, Taco Hoekwater, Elie Roux, Philipp Gesang and Kim Dohyun\\
 % Maintainer: LuaLaTeX Maintainers ---
 % Support: \email{lualatex-dev at tug.org}}
-% \date{2019/03/26 v2.20.1}
+% \date{2019/10/11 v2.20.2}
 %
 % \maketitle
 %
@@ -297,7 +297,8 @@
 % \paragraph{\cs{mpcolor}}
 %   With \cs{mpcolor} command, color names or expressions of
 %   \textsf{color}/\textsf{xcolor} packages can be used inside mplibcode
-%   enviroment, though \textsf{luamplib} does not automatically load these
+%   enviroment (after |withcolor| operator),
+%   though \textsf{luamplib} does not automatically load these
 %   packages. See the example code above. For spot colors, \textsf{(x)spotcolor}
 %   (in PDF mode) and \textsf{xespotcolor} (in DVI mode) packages are supported
 %   as well.
@@ -405,8 +406,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.",
 }
 
@@ -881,6 +882,10 @@
 %    \begin{macrocode}
 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
@@ -890,10 +895,7 @@
     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
@@ -901,17 +903,20 @@
 %    \end{macrocode}
 %
 %    Make |color| or |xcolor|'s color expressions usable,
-%    with \cs{mpcolor} or |mplibcolor|
+%    with \cs{mpcolor} or |mplibcolor|. These commands should be used
+%    with graphical objects.
 %    \begin{macrocode}
+local mplibcolor_fmt = [[\begingroup\let\XC at mcolor\relax]]..
+  [[\def\set at color{\global\mplibtmptoks\expandafter{\current at 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 at color{\\toks0\\expandafter{\\current at 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
@@ -926,8 +931,8 @@
 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
@@ -969,7 +974,7 @@
 
 local function process_verbatimtex_infig (str)
   if str then
-    return format("special \"postmplibverbtex=%s\";", str)
+    return format('special "postmplibverbtex=%s";', str)
   end
   return ""
 end
@@ -1179,8 +1184,8 @@
 %    \begin{macrocode}
   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")
 
@@ -1206,8 +1211,8 @@
   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"
 %    \end{macrocode}
 %
 %    Next line to address issue \#55
@@ -1231,9 +1236,9 @@
 %    For parsing |prescript| materials.
 %    \begin{macrocode}
 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)
@@ -1950,7 +1955,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
@@ -2100,12 +2105,13 @@
       luamplib.verbatiminput = false
     end
 }}
+\newtoks\mplibtmptoks
 %    \end{macrocode}
 %
 %    \cs{everymplib} \& \cs{everyendmplib}: macros redefining
 %    \cs{everymplibtoks} \& \cs{everyendmplibtoks} respectively
+%
 %    \begin{macrocode}
-\newtoks\mplibtmptoks
 \newtoks\everymplibtoks
 \newtoks\everyendmplibtoks
 \protected\def\everymplib{%

Modified: trunk/Master/texmf-dist/tex/luatex/luamplib/luamplib.lua
===================================================================
--- trunk/Master/texmf-dist/tex/luatex/luamplib/luamplib.lua	2019-10-11 21:33:17 UTC (rev 52344)
+++ trunk/Master/texmf-dist/tex/luatex/luamplib/luamplib.lua	2019-10-11 21:33:34 UTC (rev 52345)
@@ -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 @@
 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 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 at mcolor\relax]]..
+  [[\def\set at color{\global\mplibtmptoks\expandafter{\current at 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 at color{\\toks0\\expandafter{\\current at 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 @@
 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 @@
 
 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 @@
 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 @@
   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 @@
 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)

Modified: trunk/Master/texmf-dist/tex/luatex/luamplib/luamplib.sty
===================================================================
--- trunk/Master/texmf-dist/tex/luatex/luamplib/luamplib.sty	2019-10-11 21:33:17 UTC (rev 52344)
+++ trunk/Master/texmf-dist/tex/luatex/luamplib/luamplib.sty	2019-10-11 21:33:34 UTC (rev 52345)
@@ -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



More information about the tex-live-commits mailing list