summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2014-07-09 21:20:53 +0000
committerKarl Berry <karl@freefriends.org>2014-07-09 21:20:53 +0000
commitabee3e3f6d0f906b9fedb4f5f36eae089f865a73 (patch)
treec6c30482e02cd28f5156800314936310782efd04
parent8abeed184a80961b957fdec8d8c148f149419465 (diff)
luamplib (8jul14)
git-svn-id: svn://tug.org/texlive/trunk@34557 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Master/texmf-dist/doc/luatex/luamplib/NEWS4
-rw-r--r--Master/texmf-dist/doc/luatex/luamplib/luamplib.pdfbin135492 -> 135869 bytes
-rw-r--r--Master/texmf-dist/doc/luatex/luamplib/test-luamplib-latex.tex8
-rw-r--r--Master/texmf-dist/doc/luatex/luamplib/test-luamplib-plain.tex6
-rw-r--r--Master/texmf-dist/source/luatex/luamplib/luamplib.dtx54
-rw-r--r--Master/texmf-dist/tex/luatex/luamplib/luamplib.lua19
-rw-r--r--Master/texmf-dist/tex/luatex/luamplib/luamplib.sty19
7 files changed, 74 insertions, 36 deletions
diff --git a/Master/texmf-dist/doc/luatex/luamplib/NEWS b/Master/texmf-dist/doc/luatex/luamplib/NEWS
index 36682f27656..8f26a19aba9 100644
--- a/Master/texmf-dist/doc/luatex/luamplib/NEWS
+++ b/Master/texmf-dist/doc/luatex/luamplib/NEWS
@@ -1,5 +1,9 @@
History of the luamplib package
+2014/07/04 2.8.1
+ * support color package on plain tex.
+ * fix a failure at `btex \% etex'.
+
2014/06/17 2.8.0
* support color/xcolor/spotcolor packages.
On LaTeX, color names or expressions of color/xcolor packages
diff --git a/Master/texmf-dist/doc/luatex/luamplib/luamplib.pdf b/Master/texmf-dist/doc/luatex/luamplib/luamplib.pdf
index 6995c8cfed9..e99e6833521 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 9a07fa86f50..a7c397041b0 100644
--- a/Master/texmf-dist/doc/luatex/luamplib/test-luamplib-latex.tex
+++ b/Master/texmf-dist/doc/luatex/luamplib/test-luamplib-latex.tex
@@ -27,7 +27,13 @@ A%
verbatimtex \lower.2em etex
beginfig(0);
draw origin--(1cm,0) withcolor \mpcolor{teal};
-draw btex g\begin{huge}g\end{huge}etex withcolor \mpcolor{orange};
+draw btex g etex withcolor \mpcolor{orange};
+draw btex\tracingcommands0
+ multi%
+ \begin{huge}line\end{huge}%
+ texcode
+ with \%
+ etex shifted (10,0);
draw bbox currentpicture;
endfig;
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 c679a18a960..583c2fc4d78 100644
--- a/Master/texmf-dist/doc/luatex/luamplib/test-luamplib-plain.tex
+++ b/Master/texmf-dist/doc/luatex/luamplib/test-luamplib-plain.tex
@@ -1,3 +1,6 @@
+\input miniltx
+\input color
+\definecolor{orange}{rgb}{1,0.5,0}
\input luamplib.sty
\everymplib{ beginfig(0); }\everyendmplib{ endfig; }
\tracingcommands1
@@ -27,6 +30,7 @@ draw btex g etex withcolor blue;
draw btex\tracingcommands0 multi
line
tex code
+ 100 \% color
etex shifted (20,0);
draw textext("\tracingcommands0 textext 50\% color") shifted (10,-10) withcolor .5white;
draw bbox currentpicture;
@@ -52,7 +56,7 @@ numeric u; u=1cm;
z1=-z2=(-u,0);
for i = 1 upto 3:
draw z1..(0, i*u)..z2;
- label.top(TEX("$e_{" & decimal(i) & "}$"), (0, i*u)) withcolor blue;
+ label.top(TEX("$e_{" & decimal(i) & "}$"), (0, i*u)) withcolor \mpcolor{orange};
endfor;
endfig;
\endmplibcode
diff --git a/Master/texmf-dist/source/luatex/luamplib/luamplib.dtx b/Master/texmf-dist/source/luatex/luamplib/luamplib.dtx
index 0ac9a0a7dfc..84de6b6ba18 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}%
- [2014/06/17 v2.8.0 Interface for using the mplib library]%
+ [2014/07/04 v2.8.1 Interface for using the mplib library]%
\documentclass{ltxdoc}
\usepackage{metalogo,multicol,mdwlist,fancyvrb,xspace}
\usepackage[x11names]{xcolor}
@@ -154,7 +154,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{2014/06/17 v2.8.0}
+% \date{2014/07/04 v2.8.1}
%
% \maketitle
%
@@ -252,11 +252,10 @@ See source file '\inFileName' for licencing and contact information.
% automatically protects \TeX\ code inbetween, \cs{btex} is not supported
% here.
% \item With \cs{mpcolor} command, color names or expressions of
-% \textsf{color} or \textsf{xcolor} package can be used inside mplibcode
-% enviroment. In PDF mode, \textsf{spotcolor} package is supported
-% as well. This is a \LaTeX-only functionality and \textsf{color} or
-% \textsf{xcolor} package should be loaded by users.
-% See the example code of the previous item.
+% \textsf{color}/\textsf{xcolor} packages can be used inside mplibcode
+% enviroment, though \textsf{luamplib} does not automatically load these
+% packages. See the example code above. In PDF mode, \textsf{(x)spotcolor}
+% package is supported as well.
% \item Users can choose |numbersystem| option since v2.4.
% The default value |scaled| can be changed to |double| by declaring
% |\mplibnumbersystem{double}|. For details see
@@ -328,8 +327,8 @@ luamplib.lastlog = ""
local err, warn, info, log = luatexbase.provides_module({
name = "luamplib",
- version = "2.8.0",
- date = "2014/06/17",
+ version = "2.8.1",
+ date = "2014/07/04",
description = "Lua package to typeset Metapost with LuaTeX's MPLib.",
})
@@ -529,15 +528,17 @@ local function replaceinputmpfile (name,file)
local data = fh:read("*all"); fh:close()
data = stringgsub(data, "\"[^\n]-\"",
function(str)
- str = stringgsub(str,"%%","!!!!!PERCENT!!!!!")
str = stringgsub(str,"([bem])tex%f[^A-Z_a-z]","%1!!!T!!!E!!!X!!!")
return str
end)
- data = stringgsub(data,"%%.-\n","")
local count,cnt = 0,0
data,cnt = stringgsub(data,
"%f[A-Z_a-z]btex%f[^A-Z_a-z]%s*(.-)%s*%f[A-Z_a-z]etex%f[^A-Z_a-z]",
function(str)
+ str = stringgsub(str,"\\%%","\\!!!!!PERCENT!!!!!")
+ str = stringgsub(str,"%%.-\n", "")
+ str = stringgsub(str,"%%.-$", "")
+ str = stringgsub(str,"\\!!!!!PERCENT!!!!!","\\%%")
str = stringgsub(str,"[\n\r]%s*"," ")
str = stringgsub(str,'"','"&ditto&"')
return format("rawtextext(\"%s\")",str)
@@ -557,7 +558,6 @@ local function replaceinputmpfile (name,file)
return file
end
data = stringgsub(data,"([bem])!!!T!!!E!!!X!!!","%1tex")
- data = stringgsub(data,"!!!!!PERCENT!!!!!","%%")
fh = ioopen(newfile,"w")
if not fh then return file end
fh:write(data); fh:close()
@@ -989,10 +989,12 @@ local function protecttextext(data)
str = stringgsub(str,"([bem])tex%f[^A-Z_a-z]","%1!!!T!!!E!!!X!!!")
return str
end)
- data = stringgsub(data,"%%.-\n","")
data = stringgsub(data,
"%f[A-Z_a-z]btex%f[^A-Z_a-z]%s*(.-)%s*%f[A-Z_a-z]etex%f[^A-Z_a-z]",
function(str)
+ str = stringgsub(str,"\\%%","\\!!!!!PERCENT!!!!!")
+ str = stringgsub(str,"%%.-\n", "")
+ str = stringgsub(str,"%%.-$", "")
str = stringgsub(str,'"','"&ditto&"')
str = stringgsub(str,"\n%s*"," ")
return format("rawtextext(\"%s\")",str)
@@ -1000,6 +1002,9 @@ local function protecttextext(data)
data = stringgsub(data,
"%f[A-Z_a-z]verbatimtex%f[^A-Z_a-z]%s*(.-)%s*%f[A-Z_a-z]etex%f[^A-Z_a-z]",
function(str)
+ str = stringgsub(str,"\\%%","\\!!!!!PERCENT!!!!!")
+ str = stringgsub(str,"%%.-\n", "")
+ str = stringgsub(str,"%%.-$", "")
str = stringgsub(str,'"','"&ditto&"')
str = stringgsub(str,"\n%s*"," ")
return format("VerbatimTeX(\"%s\")",str)
@@ -1012,6 +1017,7 @@ local function protecttextext(data)
str = stringgsub(str,"#", "!!!!!SHARPE!!!!!")
return format("\\detokenize{%s}",str)
end)
+ data = stringgsub(data,"%%.-\n", "")
luamplib.mpxcolors = {}
data = stringgsub(data, "\\mpcolor%s*{(.-)}",
function(str)
@@ -1572,7 +1578,7 @@ luamplib.colorconverter = colorconverter
\else
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{luamplib}
- [2014/06/17 v2.8.0 mplib package for LuaTeX]
+ [2014/07/04 v2.8.1 mplib package for LuaTeX]
\RequirePackage{luatexbase-modutils}
\fi
% \end{macrocode}
@@ -1631,7 +1637,7 @@ luamplib.colorconverter = colorconverter
%
% \begin{macrocode}
\bgroup\expandafter\expandafter\expandafter\egroup
-\expandafter\ifx\csname ProvidesPackage\endcsname\relax
+\expandafter\ifx\csname selectfont\endcsname\relax
\def\mplibreplacenewlinecs{%
\begingroup \mplibpostmpcatcodes \mplibdoreplacenewlinecs}
\begingroup\lccode`\~=`\^^M \lowercase{\endgroup
@@ -1645,7 +1651,8 @@ luamplib.colorconverter = colorconverter
}
\long\def\mplibdocode#1\endmplibcode{%
\endgroup
- \def\mplibtemp{\directlua{luamplib.protecttextext([===[\unexpanded{#1}]===])}}%
+ \edef\mplibtemp{\directlua{luamplib.protecttextext([===[\unexpanded{#1}]===])}}%
+ \directlua{ tex.sprint(table.concat(luamplib.mpxcolors)) }%
\directlua{luamplib.tempdata = luamplib.makeTEXboxes([===[\mplibtemp]===])}%
\directlua{luamplib.processwithTEXboxes(luamplib.tempdata)}%
\endgroup
@@ -1683,8 +1690,10 @@ luamplib.colorconverter = colorconverter
\toks@\expandafter{\the\toks@\end{#2}}\expandafter\ltxdomplibcode
\fi
}
+\fi
% \end{macrocode}
-% Support color/xcolor package on \LaTeX.
+%
+% Support color/xcolor packages.
% User interface is: \verb|\mpcolor{teal}|, for example.
% \begin{macrocode}
\def\mplibcolor#1#2{%
@@ -1692,12 +1701,15 @@ luamplib.colorconverter = colorconverter
\edef#1{1 withprescript
"MPlibOverrideColor=\csname\string\color @#2\endcsname"}%
\else
- \extractcolorspecs{#2}\mplibtemp@a\mplibtemp@b
- \convertcolorspec\mplibtemp@a\mplibtemp@b{cmyk}\mplibtemp@c
- \edef#1{(\mplibtemp@c)}%
+ \ifdefined\extractcolorspecs
+ \extractcolorspecs{#2}\mplibtemp@a\mplibtemp@b
+ \convertcolorspec\mplibtemp@a\mplibtemp@b{cmyk}\mplibtemp@c
+ \edef#1{(\mplibtemp@c)}%
+ \else
+ \errmessage{Undefined color `#2'}%
+ \fi
\fi
}
-\fi
% \end{macrocode}
%
% \cs{everymplib} \& \cs{everyendmplib}: macros redefining
diff --git a/Master/texmf-dist/tex/luatex/luamplib/luamplib.lua b/Master/texmf-dist/tex/luatex/luamplib/luamplib.lua
index 4dd1b5e946c..df329392c0b 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 = ""
local err, warn, info, log = luatexbase.provides_module({
name = "luamplib",
- version = "2.8.0",
- date = "2014/06/17",
+ version = "2.8.1",
+ date = "2014/07/04",
description = "Lua package to typeset Metapost with LuaTeX's MPLib.",
})
@@ -202,15 +202,17 @@ local function replaceinputmpfile (name,file)
local data = fh:read("*all"); fh:close()
data = stringgsub(data, "\"[^\n]-\"",
function(str)
- str = stringgsub(str,"%%","!!!!!PERCENT!!!!!")
str = stringgsub(str,"([bem])tex%f[^A-Z_a-z]","%1!!!T!!!E!!!X!!!")
return str
end)
- data = stringgsub(data,"%%.-\n","")
local count,cnt = 0,0
data,cnt = stringgsub(data,
"%f[A-Z_a-z]btex%f[^A-Z_a-z]%s*(.-)%s*%f[A-Z_a-z]etex%f[^A-Z_a-z]",
function(str)
+ str = stringgsub(str,"\\%%","\\!!!!!PERCENT!!!!!")
+ str = stringgsub(str,"%%.-\n", "")
+ str = stringgsub(str,"%%.-$", "")
+ str = stringgsub(str,"\\!!!!!PERCENT!!!!!","\\%%")
str = stringgsub(str,"[\n\r]%s*"," ")
str = stringgsub(str,'"','"&ditto&"')
return format("rawtextext(\"%s\")",str)
@@ -230,7 +232,6 @@ local function replaceinputmpfile (name,file)
return file
end
data = stringgsub(data,"([bem])!!!T!!!E!!!X!!!","%1tex")
- data = stringgsub(data,"!!!!!PERCENT!!!!!","%%")
fh = ioopen(newfile,"w")
if not fh then return file end
fh:write(data); fh:close()
@@ -611,10 +612,12 @@ local function protecttextext(data)
str = stringgsub(str,"([bem])tex%f[^A-Z_a-z]","%1!!!T!!!E!!!X!!!")
return str
end)
- data = stringgsub(data,"%%.-\n","")
data = stringgsub(data,
"%f[A-Z_a-z]btex%f[^A-Z_a-z]%s*(.-)%s*%f[A-Z_a-z]etex%f[^A-Z_a-z]",
function(str)
+ str = stringgsub(str,"\\%%","\\!!!!!PERCENT!!!!!")
+ str = stringgsub(str,"%%.-\n", "")
+ str = stringgsub(str,"%%.-$", "")
str = stringgsub(str,'"','"&ditto&"')
str = stringgsub(str,"\n%s*"," ")
return format("rawtextext(\"%s\")",str)
@@ -622,6 +625,9 @@ local function protecttextext(data)
data = stringgsub(data,
"%f[A-Z_a-z]verbatimtex%f[^A-Z_a-z]%s*(.-)%s*%f[A-Z_a-z]etex%f[^A-Z_a-z]",
function(str)
+ str = stringgsub(str,"\\%%","\\!!!!!PERCENT!!!!!")
+ str = stringgsub(str,"%%.-\n", "")
+ str = stringgsub(str,"%%.-$", "")
str = stringgsub(str,'"','"&ditto&"')
str = stringgsub(str,"\n%s*"," ")
return format("VerbatimTeX(\"%s\")",str)
@@ -634,6 +640,7 @@ local function protecttextext(data)
str = stringgsub(str,"#", "!!!!!SHARPE!!!!!")
return format("\\detokenize{%s}",str)
end)
+ data = stringgsub(data,"%%.-\n", "")
luamplib.mpxcolors = {}
data = stringgsub(data, "\\mpcolor%s*{(.-)}",
function(str)
diff --git a/Master/texmf-dist/tex/luatex/luamplib/luamplib.sty b/Master/texmf-dist/tex/luatex/luamplib/luamplib.sty
index 21e321e6a91..ffee72280ff 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}
- [2014/06/17 v2.8.0 mplib package for LuaTeX]
+ [2014/07/04 v2.8.1 mplib package for LuaTeX]
\RequirePackage{luatexbase-modutils}
\fi
\RequireLuaModule{luamplib}
@@ -46,7 +46,7 @@
\begingroup\lccode`\~=`\^^M \lowercase{\endgroup
\def\mplibdoreplacenewlinebr#1^^J{\endgroup\luatexscantextokens{{}#1~}}}
\bgroup\expandafter\expandafter\expandafter\egroup
-\expandafter\ifx\csname ProvidesPackage\endcsname\relax
+\expandafter\ifx\csname selectfont\endcsname\relax
\def\mplibreplacenewlinecs{%
\begingroup \mplibpostmpcatcodes \mplibdoreplacenewlinecs}
\begingroup\lccode`\~=`\^^M \lowercase{\endgroup
@@ -60,7 +60,8 @@
}
\long\def\mplibdocode#1\endmplibcode{%
\endgroup
- \def\mplibtemp{\directlua{luamplib.protecttextext([===[\unexpanded{#1}]===])}}%
+ \edef\mplibtemp{\directlua{luamplib.protecttextext([===[\unexpanded{#1}]===])}}%
+ \directlua{ tex.sprint(table.concat(luamplib.mpxcolors)) }%
\directlua{luamplib.tempdata = luamplib.makeTEXboxes([===[\mplibtemp]===])}%
\directlua{luamplib.processwithTEXboxes(luamplib.tempdata)}%
\endgroup
@@ -93,17 +94,21 @@
\toks@\expandafter{\the\toks@\end{#2}}\expandafter\ltxdomplibcode
\fi
}
+\fi
\def\mplibcolor#1#2{%
\ifcsname\string\color @#2\endcsname
\edef#1{1 withprescript
"MPlibOverrideColor=\csname\string\color @#2\endcsname"}%
\else
- \extractcolorspecs{#2}\mplibtemp@a\mplibtemp@b
- \convertcolorspec\mplibtemp@a\mplibtemp@b{cmyk}\mplibtemp@c
- \edef#1{(\mplibtemp@c)}%
+ \ifdefined\extractcolorspecs
+ \extractcolorspecs{#2}\mplibtemp@a\mplibtemp@b
+ \convertcolorspec\mplibtemp@a\mplibtemp@b{cmyk}\mplibtemp@c
+ \edef#1{(\mplibtemp@c)}%
+ \else
+ \errmessage{Undefined color `#2'}%
+ \fi
\fi
}
-\fi
\newtoks\everymplibtoks
\newtoks\everyendmplibtoks
\protected\def\everymplib{%