diff options
Diffstat (limited to 'Master/texmf-dist/tex/luatex/luamplib/luamplib.sty')
-rw-r--r-- | Master/texmf-dist/tex/luatex/luamplib/luamplib.sty | 38 |
1 files changed, 28 insertions, 10 deletions
diff --git a/Master/texmf-dist/tex/luatex/luamplib/luamplib.sty b/Master/texmf-dist/tex/luatex/luamplib/luamplib.sty index 3df40753ad1..55508dcfeaa 100644 --- a/Master/texmf-dist/tex/luatex/luamplib/luamplib.sty +++ b/Master/texmf-dist/tex/luatex/luamplib/luamplib.sty @@ -9,12 +9,12 @@ %% See source file 'luamplib.dtx' for licencing and contact information. %% \bgroup\expandafter\expandafter\expandafter\egroup -\expandafter\ifx\csname ProvidesPackage\endcsname\relax +\expandafter\ifx\csname selectfont\endcsname\relax \input luatexbase-modutils.sty \else \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{luamplib} - [2015/03/26 v2.10.1 mplib package for LuaTeX] + [2015/08/01 v2.11.0 mplib package for LuaTeX] \RequirePackage{luatexbase-modutils} \fi \RequireLuaModule{luamplib} @@ -60,10 +60,14 @@ } \long\def\mplibdocode#1\endmplibcode{% \endgroup - \edef\mplibtemp{\directlua{luamplib.protecttextext([===[\unexpanded{#1}]===])}}% - \directlua{ tex.sprint(luamplib.mpxcolors) }% - \directlua{luamplib.tempdata = luamplib.makeTEXboxes([===[\mplibtemp]===])}% - \directlua{luamplib.processwithTEXboxes(luamplib.tempdata)}% + \ifdefined\mplibverbatimYes + \directlua{luamplib.process([===[\the\everymplibtoks\detokenize{#1}\the\everyendmplibtoks]===],true)}% + \else + \edef\mplibtemp{\directlua{luamplib.protecttextext([===[\unexpanded{#1}]===])}}% + \directlua{ tex.sprint(luamplib.mpxcolors) }% + \directlua{luamplib.tempdata = luamplib.makeTEXboxes([===[\mplibtemp]===])}% + \directlua{luamplib.processwithTEXboxes(luamplib.tempdata)}% + \fi \endgroup \ifnum\mplibstartlineno<\inputlineno\expandafter\mplibreplacenewlinecs\fi } @@ -82,10 +86,14 @@ \endgroup \toks@\expandafter{\the\toks@#1}% \def\mplibtemp@a{#2}\ifx\mplib@mplibcode\mplibtemp@a - \edef\mplibtemp{\directlua{luamplib.protecttextext([===[\the\toks@]===])}}% - \directlua{ tex.sprint(luamplib.mpxcolors) }% - \directlua{luamplib.tempdata=luamplib.makeTEXboxes([===[\mplibtemp]===])}% - \directlua{luamplib.processwithTEXboxes(luamplib.tempdata)}% + \ifdefined\mplibverbatimYes + \directlua{luamplib.process([===[\the\everymplibtoks\the\toks@\the\everyendmplibtoks]===],true)}% + \else + \edef\mplibtemp{\directlua{luamplib.protecttextext([===[\the\toks@]===])}}% + \directlua{ tex.sprint(luamplib.mpxcolors) }% + \directlua{luamplib.tempdata=luamplib.makeTEXboxes([===[\mplibtemp]===])}% + \directlua{luamplib.processwithTEXboxes(luamplib.tempdata)}% + \fi \end{mplibcode}% \ifnum\mplibstartlineno<\inputlineno \expandafter\expandafter\expandafter\mplibreplacenewlinebr @@ -95,6 +103,16 @@ \fi } \fi +\def\mplibverbatim#1{% + \begingroup + \def\mplibtempa{#1}\def\mplibtempb{enable}% + \expandafter\endgroup + \ifx\mplibtempa\mplibtempb + \let\mplibverbatimYes\relax + \else + \let\mplibverbatimYes\undefined + \fi +} \newtoks\everymplibtoks \newtoks\everyendmplibtoks \protected\def\everymplib{% |