diff options
author | Karl Berry <karl@freefriends.org> | 2019-03-26 21:01:21 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2019-03-26 21:01:21 +0000 |
commit | 1bd89250219a1f2d07e579df52dce11bbcd7e994 (patch) | |
tree | d7cd2be2fb67c15ffa33c65aebacee16b4873fd2 /Master/texmf-dist/tex/luatex/luamplib | |
parent | 92b7814a76a0652922328edf72c488cebd878be7 (diff) |
luamplib (26mar19)
git-svn-id: svn://tug.org/texlive/trunk@50608 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/luatex/luamplib')
-rw-r--r-- | Master/texmf-dist/tex/luatex/luamplib/luamplib.lua | 30 | ||||
-rw-r--r-- | Master/texmf-dist/tex/luatex/luamplib/luamplib.sty | 4 |
2 files changed, 11 insertions, 23 deletions
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 |