diff options
author | Karl Berry <karl@freefriends.org> | 2013-05-12 22:38:13 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2013-05-12 22:38:13 +0000 |
commit | 8907d5d0eb9a9b630b813f7d0ae7e406a1c4cb01 (patch) | |
tree | c075608e0fa6fbccc05bda8a8df1145ecca49cc9 /Master/texmf-dist/tex/luatex/luamplib/luamplib.sty | |
parent | 0d9028560da113b542d8cd721f3164a00d492de2 (diff) |
luamplib (12may13)
git-svn-id: svn://tug.org/texlive/trunk@30423 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/luatex/luamplib/luamplib.sty')
-rw-r--r-- | Master/texmf-dist/tex/luatex/luamplib/luamplib.sty | 68 |
1 files changed, 39 insertions, 29 deletions
diff --git a/Master/texmf-dist/tex/luatex/luamplib/luamplib.sty b/Master/texmf-dist/tex/luatex/luamplib/luamplib.sty index e71631ad539..3f435d2b31f 100644 --- a/Master/texmf-dist/tex/luatex/luamplib/luamplib.sty +++ b/Master/texmf-dist/tex/luatex/luamplib/luamplib.sty @@ -14,9 +14,9 @@ \else \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{luamplib} - [2011/12/09 v1.09 mplib package for LuaTeX] + [2013/05/07 v2.0 mplib package for LuaTeX] \RequirePackage{luatexbase-modutils} - \RequirePackage{fancyvrb} + \RequirePackage{pdftexcmds} \fi \RequireLuaModule{luamplib} \def\mplibsetformat#1{% @@ -34,23 +34,29 @@ \PackageWarning{mplib}{MPLib only works in PDF mode, no figure will be output.} \fi \fi -\bgroup\expandafter\expandafter\expandafter\egroup -\expandafter\ifx\csname ProvidesPackage\endcsname\relax \def\mplibsetupcatcodes{% - \catcode`\{=12 \catcode`\}=12 \catcode`\#=12 \catcode`\^=12 \catcode`\~=12 - \catcode`\_=12 \catcode`\%=12 \catcode`\&=12 \catcode`\$=12 + \catcode`\{=12 \catcode`\}=12 \catcode`\#=12 + \catcode`\^=12 \catcode`\~=12 \catcode`\_=12 + %catcode`\%=12 %% don^^e2^^80^^99t in Plain! + \catcode`\&=12 \catcode`\$=12 } +\def\mplibputtextbox#1{\vbox to 0pt{\vss\hbox to 0pt{\raise\dp#1\box#1\hss}}} +\bgroup\expandafter\expandafter\expandafter\egroup +\expandafter\ifx\csname ProvidesPackage\endcsname\relax \def\mplibcode{% - \bgroup % - \mplibsetupcatcodes % + \bgroup + \mplibsetupcatcodes \mplibdocode % } \long\def\mplibdocode#1\endmplibcode{% - \egroup % - \mplibprocess{#1}% -} -\long\def\mplibprocess#1{% - \directlua{luamplib.process("\luatexluaescapestring{#1}")}% + \egroup + \directlua{ + luamplib.settexboxes([===[\unexpanded{#1}]===]) + }% + \directlua{ + local data = luamplib.gettexboxes([===[\unexpanded{#1}]===]) + luamplib.process(data) + }% } \else \begingroup @@ -69,24 +75,28 @@ \def^^I{\string^^I}% } \endgroup -\newcommand\mplibaddlines[1]{% - \begingroup % - \FV@hack % - \def\FV@ProcessLine##1{% - \directlua{luamplib.addline("\luatexluaescapestring{##1}")}% - }% - \csname FV@SV@#1\endcsname % - \endgroup % +\newenvironment{mplibcode}{\toks@{}\ltxdomplibcode}{} +\def\ltxdomplibcode{% + \bgroup + \mplibsetupcatcodes + \ltxdomplibcodeindeed % } -\newenvironment{mplibcode}{% - \VerbatimEnvironment % - \begin{SaveVerbatim}{memoire}% -}{% - \end{SaveVerbatim}% - \mplibaddlines{memoire}% - \directlua{luamplib.processlines()}% +\long\def\ltxdomplibcodeindeed#1\end{% + \egroup + \toks@\expandafter{\the\toks@#1}\ltxdomplibcodefinally% +}% +\def\ltxdomplibcodefinally#1{% + \ifnum\pdf@strcmp{#1}{mplibcode}=\z@ + \directlua{luamplib.settexboxes([===[\the\toks@]===])}% + \directlua{ + local data = luamplib.gettexboxes([===[\the\toks@]===]) + luamplib.process(data) + }% + \end{mplibcode}% + \else + \toks@\expandafter{\the\toks@\end{#1}}\expandafter\ltxdomplibcode + \fi% } - \fi \ifx\mplibscratchbox\undefined \newbox\mplibscratchbox \fi \def\mplibstarttoPDF#1#2#3#4{% |