texlive[50608] Master/texmf-dist: luamplib (26mar19)

commits+karl at tug.org commits+karl at tug.org
Tue Mar 26 22:01:21 CET 2019


Revision: 50608
          http://tug.org/svn/texlive?view=revision&revision=50608
Author:   karl
Date:     2019-03-26 22:01:21 +0100 (Tue, 26 Mar 2019)
Log Message:
-----------
luamplib (26mar19)

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-03-26 21:00:48 UTC (rev 50607)
+++ trunk/Master/texmf-dist/doc/luatex/luamplib/NEWS	2019-03-26 21:01:21 UTC (rev 50608)
@@ -1,5 +1,8 @@
                        History of the luamplib package
 
+2019/03/26 2.20.1
+    * '\mpdim' and '\mpcolor' are allowed, even if '\mplibverbatim' is enabled.
+
 2019/03/20 2.20.0
     * huge changes, but mostly internal, so apparently not much difference
       from previous version.

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-03-26 21:00:48 UTC (rev 50607)
+++ trunk/Master/texmf-dist/source/luatex/luamplib/luamplib.dtx	2019-03-26 21:01:21 UTC (rev 50608)
@@ -85,7 +85,7 @@
 %<*driver>
 \NeedsTeXFormat{LaTeX2e}
 \ProvidesFile{luamplib.drv}%
-  [2019/03/20 v2.20.0 Interface for using the mplib library]%
+  [2019/03/26 v2.20.1 Interface for using the mplib library]%
 \documentclass{ltxdoc}
 \usepackage{metalogo,multicol,mdwlist,fancyvrb,xspace}
 \usepackage[x11names]{xcolor}
@@ -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/20 v2.20.0}
+% \date{2019/03/26 v2.20.1}
 %
 % \maketitle
 %
@@ -200,7 +200,7 @@
 %   from previous version.
 % \end{itemize}
 %
-% Some more changes and cuations are:
+% Some more changes and cautions are:
 %
 % \paragraph{\cs{mplibforcehmode}}
 %   When this macro is declared, every mplibcode figure box will be
@@ -376,8 +376,7 @@
 % \paragraph{\cs{mplibverbatim}}
 %   Starting with v2.11, users can issue |\mplibverbatim{enable}|, after which
 %   the contents of mplibcode environment will be read verbatim. As a result,
-%   users cannot use |\mpdim|, but |\mpcolor| is OK.
-%   All other \TeX\ commands outside
+%   except for |\mpdim| and |\mpcolor|, all other \TeX\ commands outside
 %   |btex ... etex| or |verbatimtex ... etex| are not expanded and will be fed
 %   literally into the mplib process.
 %
@@ -406,8 +405,8 @@
 
 luatexbase.provides_module {
   name          = "luamplib",
-  version       = "2.20.0",
-  date          = "2019/03/20",
+  version       = "2.20.1",
+  date          = "2019/03/26",
   description   = "Lua package to typeset Metapost with LuaTeX's MPLib.",
 }
 
@@ -441,7 +440,13 @@
 local texgettoks  = tex.gettoks
 local texgetbox   = tex.getbox
 local texruntoks  = tex.runtoks
-local texscantoks = tex.scantoks
+%    \end{macrocode}
+%
+%    We don't use |tex.scantoks| anymore. See below reagrding |tex.runtoks|.
+%    \begin{verbatim}
+%      local texscantoks = tex.scantoks
+%    \end{verbatim}
+%    \begin{macrocode}
 
 if not texruntoks then
   err("Your LuaTeX version is too old. Please upgrade it to the latest")
@@ -593,8 +598,8 @@
 %    Replace |btex ... etex| and |verbatimtex ... etex| in input files,
 %    if needed.
 %    \begin{macrocode}
-local name_b = "%f[A-Z_a-z]"
-local name_e = "%f[^A-Z_a-z]"
+local name_b = "%f[%a_]"
+local name_e = "%f[^%a_]"
 local btex_etex = name_b.."btex"..name_e.."%s*(.-)%s*"..name_b.."etex"..name_e
 local verbatimtex_etex = name_b.."verbatimtex"..name_e.."%s*(.-)%s*"..name_b.."etex"..name_e
 
@@ -671,7 +676,7 @@
       end
       return replaceinputmpfile(name,file)
     end
-    return mpkpse:find_file(name, name:match("[a-zA-Z]+$"))
+    return mpkpse:find_file(name, name:match("%a+$"))
   end
 end
 luamplib.finder = finder
@@ -813,11 +818,14 @@
 local function process (data)
 %    \end{macrocode}
 %
-%    Workaround issue \#70
+%    The workaround of issue \#70 seems to be unnecessary, as we use
+%    |make_text| now.
+%    \begin{verbatim}
+%    if not data:find(name_b.."beginfig%s*%([%+%-%s]*%d[%.%d%s]*%)") then
+%      data = data .. "beginfig(-1);endfig;"
+%    end
+%    \end{verbatim}
 %    \begin{macrocode}
-  if not data:find(name_b.."beginfig%s*%([%+%-%s]*%d[%.%d%s]*%)") then
-    data = data .. "beginfig(-1);endfig;"
-  end
   local standalone = not luamplib.codeinherit
   local currfmt = currentformat .. (luamplib.numbersystem or "scaled")
     .. tostring(luamplib.textextlabel) .. tostring(luamplib.legacy_verbatimtex)
@@ -845,13 +853,14 @@
 %    |tex.scantoks| sometimes fail to read catcode properly, especially
 %    |\#|, |\&|, or |\%|. After some experiment, we dropped using it.
 %    Instead, a function containing |tex.script| seems to work nicely.
+%    \begin{verbatim}
+%      local function run_tex_code_no_use (str, cat)
+%        cat = cat or catlatex
+%        texscantoks("mplibtmptoks", cat, str)
+%        texruntoks("mplibtmptoks")
+%      end
+%    \end{verbatim}
 %    \begin{macrocode}
-local function run_tex_code_no_use (str, cat)
-  cat = cat or catlatex
-  texscantoks("mplibtmptoks", cat, str)
-  texruntoks("mplibtmptoks")
-end
-
 local function run_tex_code (str, cat)
   cat = cat or catlatex
   texruntoks(function() texsprint(cat, str) end)
@@ -976,14 +985,12 @@
 
 %    \end{macrocode}
 %
-%    As of 2019-03, |metafun| format is not usable (issue \#79).
-%    This might workarounds the problem.
+%    For |metafun| format. see issue \#79.
 %    \begin{macrocode}
 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
-LUATEXFUNCTIONALITY = LUATEXFUNCTIONALITY or 0
 
 %    \end{macrocode}
 %
@@ -999,7 +1006,7 @@
       elseif t == "string" then
         buffer[#buffer+1] = value
       elseif t == "table" then
-        buffer[#buffer+1] = "(" .. concat(value,",") .. ")"
+        buffer[#buffer+1] = "(" .. tableconcat(value,",") .. ")"
       else -- boolean or whatever
         buffer[#buffer+1] = tostring(value)
       end
@@ -1125,9 +1132,8 @@
 primarydef s infont f = rawtextext(s) enddef;
 def fontsize expr f =
   begingroup
-  save size,pic; numeric size; picture pic;
-  pic := rawtextext("\hskip\pdffontsize\font");
-  size := xpart urcorner pic - xpart llcorner pic;
+  save size; numeric size;
+  size := mplibdimen("1em");
   if size = 0: 10pt else: size fi
   endgroup
 enddef;
@@ -1179,6 +1185,8 @@
   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
@@ -1929,9 +1937,9 @@
 %    \subsection{\texorpdfstring{\TeX}{TeX} package}
 %
 %
-%    \begin{macrocode}
+% \iffalse
 %<*package>
-%    \end{macrocode}
+% \fi
 %
 %    First we need to load some packages.
 %
@@ -1942,7 +1950,7 @@
 \else
   \NeedsTeXFormat{LaTeX2e}
   \ProvidesPackage{luamplib}
-    [2019/03/20 v2.20.0 mplib package for LuaTeX]
+    [2019/03/26 v2.20.1 mplib package for LuaTeX]
   \ifx\newluafunction\@undefined
   \input ltluatex
   \fi
@@ -1962,7 +1970,6 @@
 \ifx\pdfoutput\undefined
   \let\pdfoutput\outputmode
   \protected\def\pdfliteral{\pdfextension literal}
-  \def\pdffontsize{\dimexpr\pdffeedback fontsize\relax}
 \fi
 %    \end{macrocode}
 %
@@ -2125,10 +2132,10 @@
 }
 %    \end{macrocode}
 %
-%    Allow \TeX\ dimen macros in |mplibcode|.
-%    \begin{macrocode}
-\def\mpdim#1{ begingroup \the\dimexpr #1\relax\space endgroup } % gmp.sty
-%    \end{macrocode}
+%    Allow \TeX\ dimen macros in |mplibcode|. But now |runscript| does the job.
+%    \begin{verbatim}
+%      \def\mpdim#1{ begingroup \the\dimexpr #1\relax\space endgroup }% gmp.sty
+%    \end{verbatim}
 %
 %    MPLib's number system. Now |binary| has gone away.
 %    \begin{macrocode}
@@ -2266,9 +2273,9 @@
 %
 %    That's all folks!
 %
-%    \begin{macrocode}
+% \iffalse
 %</package>
-%    \end{macrocode}
+% \fi
 %
 % \clearpage
 % \section{The GNU GPL License v2}

Modified: trunk/Master/texmf-dist/tex/luatex/luamplib/luamplib.lua
===================================================================
--- trunk/Master/texmf-dist/tex/luatex/luamplib/luamplib.lua	2019-03-26 21:00:48 UTC (rev 50607)
+++ trunk/Master/texmf-dist/tex/luatex/luamplib/luamplib.lua	2019-03-26 21:01:21 UTC (rev 50608)
@@ -11,8 +11,8 @@
 
 luatexbase.provides_module {
   name          = "luamplib",
-  version       = "2.20.0",
-  date          = "2019/03/20",
+  version       = "2.20.1",
+  date          = "2019/03/26",
   description   = "Lua package to typeset Metapost with LuaTeX's MPLib.",
 }
 
@@ -36,7 +36,6 @@
 local texgettoks  = tex.gettoks
 local texgetbox   = tex.getbox
 local texruntoks  = tex.runtoks
-local texscantoks = tex.scantoks
 
 if not texruntoks then
   err("Your LuaTeX version is too old. Please upgrade it to the latest")
@@ -164,8 +163,8 @@
   return newfile
 end
 
-local name_b = "%f[A-Z_a-z]"
-local name_e = "%f[^A-Z_a-z]"
+local name_b = "%f[%a_]"
+local name_e = "%f[^%a_]"
 local btex_etex = name_b.."btex"..name_e.."%s*(.-)%s*"..name_b.."etex"..name_e
 local verbatimtex_etex = name_b.."verbatimtex"..name_e.."%s*(.-)%s*"..name_b.."etex"..name_e
 
@@ -231,7 +230,7 @@
       end
       return replaceinputmpfile(name,file)
     end
-    return mpkpse:find_file(name, name:match("[a-zA-Z]+$"))
+    return mpkpse:find_file(name, name:match("%a+$"))
   end
 end
 luamplib.finder = finder
@@ -330,9 +329,6 @@
 local mplibinstances = {}
 
 local function process (data)
-  if not data:find(name_b.."beginfig%s*%([%+%-%s]*%d[%.%d%s]*%)") then
-    data = data .. "beginfig(-1);endfig;"
-  end
   local standalone = not luamplib.codeinherit
   local currfmt = currentformat .. (luamplib.numbersystem or "scaled")
     .. tostring(luamplib.textextlabel) .. tostring(luamplib.legacy_verbatimtex)
@@ -350,12 +346,6 @@
 local catlatex = luatexbase.registernumber("catcodetable at latex")
 local catat11  = luatexbase.registernumber("catcodetable at atletter")
 
-local function run_tex_code_no_use (str, cat)
-  cat = cat or catlatex
-  texscantoks("mplibtmptoks", cat, str)
-  texruntoks("mplibtmptoks")
-end
-
 local function run_tex_code (str, cat)
   cat = cat or catlatex
   texruntoks(function() texsprint(cat, str) end)
@@ -446,7 +436,6 @@
 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
-LUATEXFUNCTIONALITY = LUATEXFUNCTIONALITY or 0
 
 local function mpprint(buffer,...)
   for i=1,select("#",...) do
@@ -458,7 +447,7 @@
       elseif t == "string" then
         buffer[#buffer+1] = value
       elseif t == "table" then
-        buffer[#buffer+1] = "(" .. concat(value,",") .. ")"
+        buffer[#buffer+1] = "(" .. tableconcat(value,",") .. ")"
       else -- boolean or whatever
         buffer[#buffer+1] = tostring(value)
       end
@@ -576,9 +565,8 @@
 primarydef s infont f = rawtextext(s) enddef;
 def fontsize expr f =
   begingroup
-  save size,pic; numeric size; picture pic;
-  pic := rawtextext("\hskip\pdffontsize\font");
-  size := xpart urcorner pic - xpart llcorner pic;
+  save size; numeric size;
+  size := mplibdimen("1em");
   if size = 0: 10pt else: size fi
   endgroup
 enddef;
@@ -617,6 +605,8 @@
   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

Modified: trunk/Master/texmf-dist/tex/luatex/luamplib/luamplib.sty
===================================================================
--- trunk/Master/texmf-dist/tex/luatex/luamplib/luamplib.sty	2019-03-26 21:00:48 UTC (rev 50607)
+++ trunk/Master/texmf-dist/tex/luatex/luamplib/luamplib.sty	2019-03-26 21:01:21 UTC (rev 50608)
@@ -14,7 +14,7 @@
 \else
   \NeedsTeXFormat{LaTeX2e}
   \ProvidesPackage{luamplib}
-    [2019/03/20 v2.20.0 mplib package for LuaTeX]
+    [2019/03/26 v2.20.1 mplib package for LuaTeX]
   \ifx\newluafunction\@undefined
   \input ltluatex
   \fi
@@ -26,7 +26,6 @@
 \ifx\pdfoutput\undefined
   \let\pdfoutput\outputmode
   \protected\def\pdfliteral{\pdfextension literal}
-  \def\pdffontsize{\dimexpr\pdffeedback fontsize\relax}
 \fi
 \def\mplibsetformat#1{\directlua{luamplib.setformat("#1")}}
 \ifnum\pdfoutput>0
@@ -143,7 +142,6 @@
   \everyendmplibtoks{#1}%
   \ifnum\mplibstartlineno<\inputlineno\expandafter\mplibreplacenewlinebr\fi
 }
-\def\mpdim#1{ begingroup \the\dimexpr #1\relax\space endgroup } % gmp.sty
 \def\mplibnumbersystem#1{\directlua{
   local t = "#1"
   if t == "binary" then t = "decimal" end



More information about the tex-live-commits mailing list