diff options
Diffstat (limited to 'Master/texmf-dist/source/luatex/luamplib')
-rw-r--r-- | Master/texmf-dist/source/luatex/luamplib/luamplib.dtx | 45 |
1 files changed, 24 insertions, 21 deletions
diff --git a/Master/texmf-dist/source/luatex/luamplib/luamplib.dtx b/Master/texmf-dist/source/luatex/luamplib/luamplib.dtx index 9d1af863bf3..3b03b6935fe 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}% - [2016/01/02 v2.11.2 Interface for using the mplib library]% + [2016/03/31 v2.11.3 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/01/02 v2.11.2} +% \date{2016/03/31 v2.11.3} % % \maketitle % @@ -369,8 +369,8 @@ luamplib.lastlog = "" luatexbase.provides_module { name = "luamplib", - version = "2.11.2", - date = "2016/01/02", + version = "2.11.3", + date = "2016/03/31", description = "Lua package to typeset Metapost with LuaTeX's MPLib.", } @@ -1136,6 +1136,8 @@ end luamplib.protecttextextVerbatim = protecttextextVerbatim +luamplib.mpxcolors = {} + local function protecttextext(data) data = protect_tex_text_common(data) @@ -1150,13 +1152,14 @@ local function protecttextext(data) data = data:gsub("%%.-\n", "") - luamplib.mpxcolors = {} + local grouplevel = tex.currentgrouplevel + luamplib.mpxcolors[grouplevel] = {} data = data:gsub("\\mpcolor"..endname.."(.-){(.-)}", function(opt,str) - local cnt = #luamplib.mpxcolors + 1 - luamplib.mpxcolors[cnt] = format( - "\\expandafter\\mplibcolor\\csname mpxcolor%i\\endcsname%s{%s}", - cnt,opt,str) - return format("\\csname mpxcolor%i\\endcsname",cnt) + local cnt = #luamplib.mpxcolors[grouplevel] + 1 + luamplib.mpxcolors[grouplevel][cnt] = format( + "\\expandafter\\mplibcolor\\csname mpxcolor%i:%i\\endcsname%s{%s}", + grouplevel,cnt,opt,str) + return format("\\csname mpxcolor%i:%i\\endcsname",grouplevel,cnt) end) % \end{macrocode} @@ -1705,7 +1708,7 @@ luamplib.colorconverter = colorconverter \else \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{luamplib} - [2016/01/02 v2.11.2 mplib package for LuaTeX] + [2016/03/31 v2.11.3 mplib package for LuaTeX] \ifx\newluafunction\@undefined \input ltluatex \fi @@ -1792,13 +1795,13 @@ luamplib.colorconverter = colorconverter \long\def\mplibdocode#1\endmplibcode{% \endgroup \ifdefined\mplibverbatimYes - \directlua{luamplib.tempdata = luamplib.protecttextextVerbatim([===[\detokenize{#1}]===])}% - \directlua{luamplib.processwithTEXboxes(luamplib.tempdata)}% + \directlua{luamplib.tempdata\the\currentgrouplevel=luamplib.protecttextextVerbatim([===[\detokenize{#1}]===])}% + \directlua{luamplib.processwithTEXboxes(luamplib.tempdata\the\currentgrouplevel)}% \else \edef\mplibtemp{\directlua{luamplib.protecttextext([===[\unexpanded{#1}]===])}}% - \directlua{ tex.sprint(luamplib.mpxcolors) }% - \directlua{luamplib.tempdata = luamplib.makeTEXboxes([===[\mplibtemp]===])}% - \directlua{luamplib.processwithTEXboxes(luamplib.tempdata)}% + \directlua{ tex.sprint(luamplib.mpxcolors[\the\currentgrouplevel]) }% + \directlua{luamplib.tempdata\the\currentgrouplevel=luamplib.makeTEXboxes([===[\mplibtemp]===])}% + \directlua{luamplib.processwithTEXboxes(luamplib.tempdata\the\currentgrouplevel)}% \fi \endgroup \ifnum\mplibstartlineno<\inputlineno\expandafter\mplibreplacenewlinecs\fi @@ -1824,13 +1827,13 @@ luamplib.colorconverter = colorconverter \toks@\expandafter{\the\toks@#1}% \def\mplibtemp@a{#2}\ifx\mplib@mplibcode\mplibtemp@a \ifdefined\mplibverbatimYes - \directlua{luamplib.tempdata = luamplib.protecttextextVerbatim([===[\the\toks@]===])}% - \directlua{luamplib.processwithTEXboxes(luamplib.tempdata)}% + \directlua{luamplib.tempdata\the\currentgrouplevel=luamplib.protecttextextVerbatim([===[\the\toks@]===])}% + \directlua{luamplib.processwithTEXboxes(luamplib.tempdata\the\currentgrouplevel)}% \else \edef\mplibtemp{\directlua{luamplib.protecttextext([===[\the\toks@]===])}}% - \directlua{ tex.sprint(luamplib.mpxcolors) }% - \directlua{luamplib.tempdata=luamplib.makeTEXboxes([===[\mplibtemp]===])}% - \directlua{luamplib.processwithTEXboxes(luamplib.tempdata)}% + \directlua{ tex.sprint(luamplib.mpxcolors[\the\currentgrouplevel]) }% + \directlua{luamplib.tempdata\the\currentgrouplevel=luamplib.makeTEXboxes([===[\mplibtemp]===])}% + \directlua{luamplib.processwithTEXboxes(luamplib.tempdata\the\currentgrouplevel)}% \fi \end{mplibcode}% \ifnum\mplibstartlineno<\inputlineno |