summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source
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/source
parent92b7814a76a0652922328edf72c488cebd878be7 (diff)
luamplib (26mar19)
git-svn-id: svn://tug.org/texlive/trunk@50608 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source')
-rw-r--r--Master/texmf-dist/source/luatex/luamplib/luamplib.dtx83
1 files changed, 45 insertions, 38 deletions
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}