summaryrefslogtreecommitdiff
path: root/Master/texmf-dist
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2017-06-06 21:48:32 +0000
committerKarl Berry <karl@freefriends.org>2017-06-06 21:48:32 +0000
commitb2a99323e6605b0822417671e97c8f5ba8ca845a (patch)
tree8b75ba8bdb36b1ae755f5b9e756cf284e4bbd27b /Master/texmf-dist
parentb9a2d960ad053d5f69cd566296f5573f8f554380 (diff)
luamplib (6jun17)
git-svn-id: svn://tug.org/texlive/trunk@44496 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
-rw-r--r--Master/texmf-dist/doc/luatex/luamplib/NEWS5
-rw-r--r--Master/texmf-dist/doc/luatex/luamplib/luamplib.pdfbin159306 -> 160247 bytes
-rw-r--r--Master/texmf-dist/doc/luatex/luamplib/test-luamplib-latex.tex16
-rw-r--r--Master/texmf-dist/doc/luatex/luamplib/test-luamplib-plain.tex16
-rw-r--r--Master/texmf-dist/source/luatex/luamplib/luamplib.dtx56
-rw-r--r--Master/texmf-dist/tex/luatex/luamplib/luamplib.lua16
-rw-r--r--Master/texmf-dist/tex/luatex/luamplib/luamplib.sty12
7 files changed, 95 insertions, 26 deletions
diff --git a/Master/texmf-dist/doc/luatex/luamplib/NEWS b/Master/texmf-dist/doc/luatex/luamplib/NEWS
index 4df1e017121..bb0748f463d 100644
--- a/Master/texmf-dist/doc/luatex/luamplib/NEWS
+++ b/Master/texmf-dist/doc/luatex/luamplib/NEWS
@@ -1,5 +1,10 @@
History of the luamplib package
+2017/06/02 2.12.1
+ * when \mplibglobaltextext{enable} is declared, metapost variables
+ containing btex ... etex labels can be inherited across code chunks.
+ Of course, \mplibcodeinherit should also be switched on.
+
2016/03/31 2.11.3
* fix a bug regarding nested mplibcode environments (issue #63)
diff --git a/Master/texmf-dist/doc/luatex/luamplib/luamplib.pdf b/Master/texmf-dist/doc/luatex/luamplib/luamplib.pdf
index 737c4fc9b10..63d5616d1e4 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/doc/luatex/luamplib/test-luamplib-latex.tex b/Master/texmf-dist/doc/luatex/luamplib/test-luamplib-latex.tex
index 016ac80c846..a500e2181dd 100644
--- a/Master/texmf-dist/doc/luatex/luamplib/test-luamplib-latex.tex
+++ b/Master/texmf-dist/doc/luatex/luamplib/test-luamplib-latex.tex
@@ -62,7 +62,21 @@ for i = 1 upto 3:
endfor;
endfig;
\end{mplibcode}%
-B\par
+B\par\leavevmode
+\mplibcodeinherit{enable}%
+\mplibglobaltextext{enable}%
+\everymplib{ beginfig(0);}\everyendmplib{ endfig;}%
+\begin{mplibcode}
+ label(btex $\sqrt{2}$ etex, origin);
+ draw fullcircle scaled 20;
+ picture pic; pic := currentpicture;
+\end{mplibcode}%
+\begin{mplibcode}
+ currentpicture := pic scaled 2;
+\end{mplibcode}%
+\everymplib{}\everyendmplib{}%
+\mplibcodeinherit{disable}%
+\mplibglobaltextext{disable}\par
\mplibsetformat{metafun}%
\begin{mplibcode}
verbatimtex \moveright 0.4\hsize etex
diff --git a/Master/texmf-dist/doc/luatex/luamplib/test-luamplib-plain.tex b/Master/texmf-dist/doc/luatex/luamplib/test-luamplib-plain.tex
index 1a76f1e857f..d7a8ed90bcc 100644
--- a/Master/texmf-dist/doc/luatex/luamplib/test-luamplib-plain.tex
+++ b/Master/texmf-dist/doc/luatex/luamplib/test-luamplib-plain.tex
@@ -60,7 +60,21 @@ for i = 1 upto 3:
endfor;
endfig;
\endmplibcode
-B\par
+B\par\leavevmode
+\mplibcodeinherit{enable}%
+\mplibglobaltextext{enable}%
+\everymplib{ beginfig(0);}\everyendmplib{ endfig;}%
+\mplibcode
+ label(btex $\sqrt{2}$ etex, origin);
+ draw fullcircle scaled 20;
+ picture pic; pic := currentpicture;
+\endmplibcode
+\mplibcode
+ currentpicture := pic scaled 2;
+\endmplibcode
+\everymplib{}\everyendmplib{}%
+\mplibcodeinherit{disable}%
+\mplibglobaltextext{disable}\par
\mplibsetformat{metafun}%
\mplibcode
verbatimtex \moveright 0.4\hsize etex
diff --git a/Master/texmf-dist/source/luatex/luamplib/luamplib.dtx b/Master/texmf-dist/source/luatex/luamplib/luamplib.dtx
index 3b03b6935fe..b044a7f6c0a 100644
--- a/Master/texmf-dist/source/luatex/luamplib/luamplib.dtx
+++ b/Master/texmf-dist/source/luatex/luamplib/luamplib.dtx
@@ -1,6 +1,6 @@
% \iffalse meta-comment -- by the way, this file contains UTF-8
%
-% Copyright (C) 2008-2016 by Hans Hagen, Taco Hoekwater, Elie Roux,
+% Copyright (C) 2008-2017 by Hans Hagen, Taco Hoekwater, Elie Roux,
% Manuel Pégourié-Gonnard, Philipp Gesang and Kim Dohyun.
% Currently maintained by the LuaLaTeX development team.
% Support: <lualatex-dev@tug.org>
@@ -85,7 +85,7 @@ See source file '\inFileName' for licencing and contact information.
%<*driver>
\NeedsTeXFormat{LaTeX2e}
\ProvidesFile{luamplib.drv}%
- [2016/03/31 v2.11.3 Interface for using the mplib library]%
+ [2017/06/02 v2.12.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{2016/03/31 v2.11.3}
+% \date{2017/06/02 v2.12.1}
%
% \maketitle
%
@@ -310,21 +310,25 @@ See source file '\inFileName' for licencing and contact information.
% each code chunks being treated as an independent instance, and never
% affected by previous code chunks.
%
-% \textsc{n.b.} It does not work to pass across code chunks those variables
-% containing |btex ... etex| pictures, as these are not METAPOST, but \TeX\
-% elements from the standpoint of \textsf{luamplib}. Likewise, |graph.mp|
-% does not work properly with the inheritance functionality.
+% \textsc{n.b.}
+% To inherit |btex ... etex| labels as well as metapost variables,
+% it is necessary to declare \cs{mplibglobaltextext\{enable\}} in advance.
+% On this case, be careful that normal \TeX\ boxes can conflict with
+% |btex ... etex| boxes, though this would occur very rarely.
+% Notwithstanding the danger, it is a `must' option to activate
+% \cs{mplibglobaltextext} if you want to use |graph.mp|
+% with \cs{mplibcodeinherit} functionality.
% \begin{verbatim}
% \mplibcodeinherit{enable}
+% \mplibglobaltextext{enable}
% \everymplib{ beginfig(0);} \everyendmplib{ endfig;}
-% A circle
% \mplibcode
-% u := 10;
-% draw fullcircle scaled u;
+% label(btex $\sqrt{2}$ etex, origin);
+% draw fullcircle scaled 20;
+% picture pic; pic := currentpicture;
% \endmplibcode
-% and twice the size
% \mplibcode
-% draw fullcircle scaled 2u;
+% currentpicture := pic scaled 2;
% \endmplibcode
% \end{verbatim}
% \item Starting with v2.11, users can issue |\mplibverbatim{enable}|, after which
@@ -369,8 +373,8 @@ luamplib.lastlog = ""
luatexbase.provides_module {
name = "luamplib",
- version = "2.11.3",
- date = "2016/03/31",
+ version = "2.12.1",
+ date = "2017/06/02",
description = "Lua package to typeset Metapost with LuaTeX's MPLib.",
}
@@ -1069,9 +1073,12 @@ enddef;
luamplib.textextlabelpreamble = textextlabelpreamble
local TeX_code_t = {}
+local texboxnum = { 2047 }
local function domakeTEXboxes (data)
- local num = 255 -- output box
+ local num = texboxnum[1]
+ texboxnum[2] = num
+ local global = luamplib.globaltextext and "\\global" or ""
if data and data.fig then
local figures = data.fig
for f=1, #figures do
@@ -1086,7 +1093,7 @@ local function domakeTEXboxes (data)
local str = prescript and prescript.MPlibmkTEXbox
if str then
num = num + 1
- texsprint(format("\\setbox%i\\hbox{%s}",num,str))
+ texsprint(format("%s\\setbox%i\\hbox{%s}", global, num, str))
end
% \end{macrocode}
% |verbatimtex ... etex| before |beginfig()| is not ignored,
@@ -1100,6 +1107,9 @@ local function domakeTEXboxes (data)
end
end
end
+ if luamplib.globaltextext then
+ texboxnum[1] = num
+ end
end
local function protect_tex_text_common (data)
@@ -1189,7 +1199,7 @@ local factor = 65536*(7227/7200)
local function processwithTEXboxes (data)
if not data then return end
- local num = 255 -- output box
+ local num = texboxnum[2]
local prepreamble = format("TEXBOX_:=%i;\n",num)
while true do
num = num + 1
@@ -1708,7 +1718,7 @@ luamplib.colorconverter = colorconverter
\else
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{luamplib}
- [2016/03/31 v2.11.3 mplib package for LuaTeX]
+ [2017/06/02 v2.12.1 mplib package for LuaTeX]
\ifx\newluafunction\@undefined
\input ltluatex
\fi
@@ -1939,6 +1949,16 @@ luamplib.colorconverter = colorconverter
\fi
\endgroup
}
+\def\mplibglobaltextext#1{%
+ \begingroup
+ \def\tempa{enable}\def\tempb{#1}%
+ \ifx\tempa\tempb
+ \directlua{luamplib.globaltextext = true}%
+ \else
+ \directlua{luamplib.globaltextext = false}%
+ \fi
+ \endgroup
+}
% \end{macrocode}
%
% We use a dedicated scratchbox.
diff --git a/Master/texmf-dist/tex/luatex/luamplib/luamplib.lua b/Master/texmf-dist/tex/luatex/luamplib/luamplib.lua
index 5030c708e47..3944df1502d 100644
--- a/Master/texmf-dist/tex/luatex/luamplib/luamplib.lua
+++ b/Master/texmf-dist/tex/luatex/luamplib/luamplib.lua
@@ -18,8 +18,8 @@ luamplib.lastlog = ""
luatexbase.provides_module {
name = "luamplib",
- version = "2.11.3",
- date = "2016/03/31",
+ version = "2.12.1",
+ date = "2017/06/02",
description = "Lua package to typeset Metapost with LuaTeX's MPLib.",
}
@@ -641,9 +641,12 @@ enddef;
luamplib.textextlabelpreamble = textextlabelpreamble
local TeX_code_t = {}
+local texboxnum = { 2047 }
local function domakeTEXboxes (data)
- local num = 255 -- output box
+ local num = texboxnum[1]
+ texboxnum[2] = num
+ local global = luamplib.globaltextext and "\\global" or ""
if data and data.fig then
local figures = data.fig
for f=1, #figures do
@@ -658,7 +661,7 @@ local function domakeTEXboxes (data)
local str = prescript and prescript.MPlibmkTEXbox
if str then
num = num + 1
- texsprint(format("\\setbox%i\\hbox{%s}",num,str))
+ texsprint(format("%s\\setbox%i\\hbox{%s}", global, num, str))
end
local texcode = prescript and prescript.MPlibVerbTeX
if texcode and texcode ~= "" then
@@ -668,6 +671,9 @@ local function domakeTEXboxes (data)
end
end
end
+ if luamplib.globaltextext then
+ texboxnum[1] = num
+ end
end
local function protect_tex_text_common (data)
@@ -754,7 +760,7 @@ local factor = 65536*(7227/7200)
local function processwithTEXboxes (data)
if not data then return end
- local num = 255 -- output box
+ local num = texboxnum[2]
local prepreamble = format("TEXBOX_:=%i;\n",num)
while true do
num = num + 1
diff --git a/Master/texmf-dist/tex/luatex/luamplib/luamplib.sty b/Master/texmf-dist/tex/luatex/luamplib/luamplib.sty
index e9eb69dbd00..be9b9507ee9 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}
- [2016/03/31 v2.11.3 mplib package for LuaTeX]
+ [2017/06/02 v2.12.1 mplib package for LuaTeX]
\ifx\newluafunction\@undefined
\input ltluatex
\fi
@@ -197,6 +197,16 @@
\fi
\endgroup
}
+\def\mplibglobaltextext#1{%
+ \begingroup
+ \def\tempa{enable}\def\tempb{#1}%
+ \ifx\tempa\tempb
+ \directlua{luamplib.globaltextext = true}%
+ \else
+ \directlua{luamplib.globaltextext = false}%
+ \fi
+ \endgroup
+}
\ifx\mplibscratchbox\undefined \newbox\mplibscratchbox \fi
\def\mplibstarttoPDF#1#2#3#4{%
\hbox\bgroup