summaryrefslogtreecommitdiff
path: root/Master/texmf-dist
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2019-03-26 21:01:21 +0000
committerKarl Berry <karl@freefriends.org>2019-03-26 21:01:21 +0000
commit1bd89250219a1f2d07e579df52dce11bbcd7e994 (patch)
treed7cd2be2fb67c15ffa33c65aebacee16b4873fd2 /Master/texmf-dist
parent92b7814a76a0652922328edf72c488cebd878be7 (diff)
luamplib (26mar19)
git-svn-id: svn://tug.org/texlive/trunk@50608 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
-rw-r--r--Master/texmf-dist/doc/luatex/luamplib/NEWS3
-rw-r--r--Master/texmf-dist/doc/luatex/luamplib/luamplib.pdfbin163569 -> 148871 bytes
-rw-r--r--Master/texmf-dist/source/luatex/luamplib/luamplib.dtx83
-rw-r--r--Master/texmf-dist/tex/luatex/luamplib/luamplib.lua30
-rw-r--r--Master/texmf-dist/tex/luatex/luamplib/luamplib.sty4
5 files changed, 59 insertions, 61 deletions
diff --git a/Master/texmf-dist/doc/luatex/luamplib/NEWS b/Master/texmf-dist/doc/luatex/luamplib/NEWS
index 8fb7136dba6..22279f9c354 100644
--- a/Master/texmf-dist/doc/luatex/luamplib/NEWS
+++ b/Master/texmf-dist/doc/luatex/luamplib/NEWS
@@ -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.
diff --git a/Master/texmf-dist/doc/luatex/luamplib/luamplib.pdf b/Master/texmf-dist/doc/luatex/luamplib/luamplib.pdf
index e119f2d6605..96852e5d3f1 100644
--- a/Master/texmf-dist/doc/luatex/luamplib/luamplib.pdf
+++ b/Master/texmf-dist/doc/luatex/luamplib/luamplib.pdf
Binary files differ
diff --git a/Master/texmf-dist/source/luatex/luamplib/luamplib.dtx b/Master/texmf-dist/source/luatex/luamplib/luamplib.dtx
index 35ac43b3c02..8524830d783 100644
--- a/Master/texmf-dist/source/luatex/luamplib/luamplib.dtx
+++ b/Master/texmf-dist/source/luatex/luamplib/luamplib.dtx
@@ -85,7 +85,7 @@ See source file '\inFileName' for licencing and contact information.
%<*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 @@ See source file '\inFileName' for licencing and contact information.
% \author{Hans Hagen, Taco Hoekwater, Elie Roux, Philipp Gesang and Kim Dohyun\\
% Maintainer: LuaLaTeX Maintainers ---
% Support: \email{lualatex-dev@tug.org}}
-% \date{2019/03/20 v2.20.0}
+% \date{2019/03/26 v2.20.1}
%
% \maketitle
%
@@ -200,7 +200,7 @@ See source file '\inFileName' for licencing and contact information.
% 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 @@ See source file '\inFileName' for licencing and contact information.
% \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 @@ See source file '\inFileName' for licencing and contact information.
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 texget = tex.get
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 @@ end
% 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 @@ local function finder(name, mode, ftype)
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 mplibinstances = {}
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 @@ local catat11 = luatexbase.registernumber("catcodetable@atletter")
% |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 @@ local runscript_funcs = {
% \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 @@ local function mpprint(buffer,...)
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 @@ local textextlabelpreamble = [[
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 @@ local function process_mplibcode (data)
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 @@ luamplib.colorconverter = colorconverter
% \subsection{\texorpdfstring{\TeX}{TeX} package}
%
%
-% \begin{macrocode}
+% \iffalse
%<*package>
-% \end{macrocode}
+% \fi
%
% First we need to load some packages.
%
@@ -1942,7 +1950,7 @@ luamplib.colorconverter = colorconverter
\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 @@ luamplib.colorconverter = colorconverter
\ifx\pdfoutput\undefined
\let\pdfoutput\outputmode
\protected\def\pdfliteral{\pdfextension literal}
- \def\pdffontsize{\dimexpr\pdffeedback fontsize\relax}
\fi
% \end{macrocode}
%
@@ -2125,10 +2132,10 @@ luamplib.colorconverter = colorconverter
}
% \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 @@ luamplib.colorconverter = colorconverter
%
% That's all folks!
%
-% \begin{macrocode}
+% \iffalse
%</package>
-% \end{macrocode}
+% \fi
%
% \clearpage
% \section{The GNU GPL License v2}
diff --git a/Master/texmf-dist/tex/luatex/luamplib/luamplib.lua b/Master/texmf-dist/tex/luatex/luamplib/luamplib.lua
index c94fb761fc9..bf4603cdeca 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.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 texget = tex.get
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 @@ local function replaceformatmp(file,newfile,ofmodify)
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 @@ local function finder(name, mode, ftype)
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 @@ luamplib.codeinherit = false
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 @@ end
local catlatex = luatexbase.registernumber("catcodetable@latex")
local catat11 = luatexbase.registernumber("catcodetable@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 @@ 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
local function mpprint(buffer,...)
for i=1,select("#",...) do
@@ -458,7 +447,7 @@ local function mpprint(buffer,...)
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 @@ local textextlabelpreamble = [[
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 @@ local function process_mplibcode (data)
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
diff --git a/Master/texmf-dist/tex/luatex/luamplib/luamplib.sty b/Master/texmf-dist/tex/luatex/luamplib/luamplib.sty
index dfca44a5c3e..8fed794485a 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/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