texlive[53099] Master/texmf-dist: luamplib (11dec19)

commits+karl at tug.org commits+karl at tug.org
Wed Dec 11 22:54:44 CET 2019


Revision: 53099
          http://tug.org/svn/texlive?view=revision&revision=53099
Author:   karl
Date:     2019-12-11 22:54:44 +0100 (Wed, 11 Dec 2019)
Log Message:
-----------
luamplib (11dec19)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/luatex/luamplib/NEWS
    trunk/Master/texmf-dist/doc/luatex/luamplib/luamplib.pdf
    trunk/Master/texmf-dist/doc/luatex/luamplib/test-luamplib-latex.tex
    trunk/Master/texmf-dist/doc/luatex/luamplib/test-luamplib-plain.tex
    trunk/Master/texmf-dist/source/luatex/luamplib/luamplib.dtx
    trunk/Master/texmf-dist/tex/luatex/luamplib/luamplib.lua
    trunk/Master/texmf-dist/tex/luatex/luamplib/luamplib.sty

Modified: trunk/Master/texmf-dist/doc/luatex/luamplib/NEWS
===================================================================
--- trunk/Master/texmf-dist/doc/luatex/luamplib/NEWS	2019-12-11 21:54:32 UTC (rev 53098)
+++ trunk/Master/texmf-dist/doc/luatex/luamplib/NEWS	2019-12-11 21:54:44 UTC (rev 53099)
@@ -1,5 +1,9 @@
                        History of the luamplib package
 
+2019/12/11 2.20.4
+    * remove unnecessary setting of endlinechar
+    * \prependtomplibbox instead of \mplibhmodeornot
+
 2019/11/14 2.20.3
     * fix issue #86 (LaTeX command inside metapost label)
 

Modified: trunk/Master/texmf-dist/doc/luatex/luamplib/luamplib.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/luatex/luamplib/test-luamplib-latex.tex
===================================================================
--- trunk/Master/texmf-dist/doc/luatex/luamplib/test-luamplib-latex.tex	2019-12-11 21:54:32 UTC (rev 53098)
+++ trunk/Master/texmf-dist/doc/luatex/luamplib/test-luamplib-latex.tex	2019-12-11 21:54:44 UTC (rev 53099)
@@ -31,7 +31,7 @@
 draw btex g etex withcolor \mpcolor{orange};
 draw btex\tracingcommands0
   multi%
-  \begin{huge}line\end{huge}%
+  \begin{huge}line\end{huge}
   texcode
   with \%
   etex shifted (10,0);
@@ -63,7 +63,7 @@
 endfor;
 endfig;
 \end{mplibcode}%
-B\par\leavevmode
+B\par\mplibforcehmode
 \mplibcodeinherit{enable}%
 \mplibglobaltextext{enable}%
 \everymplib{ beginfig(0);}\everyendmplib{ endfig;}%
@@ -75,6 +75,7 @@
 \begin{mplibcode}
  currentpicture := pic scaled 2;
 \end{mplibcode}%
+\mplibnoforcehmode
 \everymplib{}\everyendmplib{}%
 \mplibcodeinherit{disable}%
 \mplibglobaltextext{disable}\par
@@ -101,8 +102,9 @@
 \end{mplibcode}%
 
 \newbox\mympbox
+\def\prependtomplibbox{\global\setbox\mympbox}%
 \begin{mplibcode}
-verbatimtex \global\setbox\mympbox etex
+%verbatimtex \global\setbox\mympbox etex
 beginfig(0);
 breadth=.667\mpdim\linewidth;
 height=2pt;
@@ -117,6 +119,7 @@
 \copy\mympbox
 \copy\mympbox
 
+\mplibnoforcehmode
 \mplibnumbersystem{double}%
 \begin{mplibcode}
 beginfig(0);

Modified: trunk/Master/texmf-dist/doc/luatex/luamplib/test-luamplib-plain.tex
===================================================================
--- trunk/Master/texmf-dist/doc/luatex/luamplib/test-luamplib-plain.tex	2019-12-11 21:54:32 UTC (rev 53098)
+++ trunk/Master/texmf-dist/doc/luatex/luamplib/test-luamplib-plain.tex	2019-12-11 21:54:44 UTC (rev 53099)
@@ -61,7 +61,7 @@
 endfor;
 endfig;
 \endmplibcode
-B\par\leavevmode
+B\par\mplibforcehmode
 \mplibcodeinherit{enable}%
 \mplibglobaltextext{enable}%
 \everymplib{ beginfig(0);}\everyendmplib{ endfig;}%
@@ -73,6 +73,7 @@
 \mplibcode
  currentpicture := pic scaled 2;
 \endmplibcode
+\mplibnoforcehmode
 \everymplib{}\everyendmplib{}%
 \mplibcodeinherit{disable}%
 \mplibglobaltextext{disable}\par
@@ -99,8 +100,9 @@
 \endmplibcode
 
 \newbox\mympbox
+\def\prependtomplibbox{\global\setbox\mympbox}%
 \mplibcode
-verbatimtex \global\setbox\mympbox etex
+%verbatimtex \global\setbox\mympbox etex
 beginfig(0);
 breadth=.667\mpdim\hsize;
 height=2pt;
@@ -115,6 +117,7 @@
 \copy\mympbox
 \copy\mympbox
 
+\mplibnoforcehmode
 \mplibnumbersystem{double}%
 \mplibcode
 beginfig(0);

Modified: trunk/Master/texmf-dist/source/luatex/luamplib/luamplib.dtx
===================================================================
--- trunk/Master/texmf-dist/source/luatex/luamplib/luamplib.dtx	2019-12-11 21:54:32 UTC (rev 53098)
+++ trunk/Master/texmf-dist/source/luatex/luamplib/luamplib.dtx	2019-12-11 21:54:44 UTC (rev 53099)
@@ -85,7 +85,7 @@
 %<*driver>
 \NeedsTeXFormat{LaTeX2e}
 \ProvidesFile{luamplib.drv}%
-  [2019/10/11 v2.20.2 Interface for using the mplib library]%
+  [2019/12/11 v2.20.4 Interface for using the mplib library]%
 \documentclass{ltxdoc}
 \usepackage{metalogo,multicol,mdwlist,fancyvrb,xspace}
 \usepackage[x11names]{xcolor}
@@ -153,7 +153,7 @@
 % \author{Hans Hagen, Taco Hoekwater, Elie Roux, Philipp Gesang and Kim Dohyun\\
 % Maintainer: LuaLaTeX Maintainers ---
 % Support: \email{lualatex-dev at tug.org}}
-% \date{2019/10/11 v2.20.2}
+% \date{2019/12/11 v2.20.4}
 %
 % \maketitle
 %
@@ -206,7 +206,8 @@
 %   When this macro is declared, every mplibcode figure box will be
 %   typeset in horizontal mode, so \cs{centering}, \cs{raggedleft} etc
 %   will have effects. |\mplibnoforcehmode|, being default, reverts this
-%   setting.
+%   setting. (Actually these commands redefine |\prependtomplibbox|. You
+%   can define this command with anything suitable before a box.)
 %
 % \paragraph{\cs{mpliblegacybehavior\{enable\}}}
 %   By default, |\mpliblegacybehavior{enable}| is already declared,
@@ -406,8 +407,8 @@
 
 luatexbase.provides_module {
   name          = "luamplib",
-  version       = "2.20.2",
-  date          = "2019/10/11",
+  version       = "2.20.4",
+  date          = "2019/12/11",
   description   = "Lua package to typeset Metapost with LuaTeX's MPLib.",
 }
 
@@ -1959,7 +1960,7 @@
 \else
   \NeedsTeXFormat{LaTeX2e}
   \ProvidesPackage{luamplib}
-    [2019/10/11 v2.20.2 mplib package for LuaTeX]
+    [2019/12/11 v2.20.4 mplib package for LuaTeX]
   \ifx\newluafunction\@undefined
   \input ltluatex
   \fi
@@ -2007,8 +2008,8 @@
 %
 %    Make |mplibcode| typesetted always in horizontal mode.
 %    \begin{macrocode}
-\def\mplibforcehmode{\let\mplibhmodeornot\leavevmode}
-\def\mplibnoforcehmode{\let\mplibhmodeornot\relax}
+\def\mplibforcehmode{\let\prependtomplibbox\leavevmode}
+\def\mplibnoforcehmode{\let\prependtomplibbox\relax}
 \mplibnoforcehmode
 %    \end{macrocode}
 %
@@ -2015,9 +2016,9 @@
 %    Catcode. We want to allow comment sign in |mplibcode|.
 %    \begin{macrocode}
 \def\mplibsetupcatcodes{%
-  \mplibhmodeornot %catcode`\{=12 %catcode`\}=12
+  %catcode`\{=12 %catcode`\}=12
   \catcode`\#=12 \catcode`\^=12 \catcode`\~=12 \catcode`\_=12
-  \catcode`\&=12 \catcode`\$=12 \catcode`\%=12 \catcode`\^^M=12 \endlinechar=10
+  \catcode`\&=12 \catcode`\$=12 \catcode`\%=12 \catcode`\^^M=12
 }
 %    \end{macrocode}
 %
@@ -2026,28 +2027,11 @@
 \def\mplibputtextbox#1{\vbox to 0pt{\vss\hbox to 0pt{\raise\dp#1\copy#1\hss}}}
 %    \end{macrocode}
 %
-%    As we have changed |^^J| catcode, the last line containing
-%    |\end{mplibcode}| has |\n| at the end. Replace it with |^^M|.
-%    \begin{macrocode}
-\newcount\mplibstartlineno
-\def\mplibpostmpcatcodes{%
-  \catcode`\{=12 \catcode`\}=12 \catcode`\#=12 \catcode`\%=12 }
-\def\mplibreplacenewlinebr{%
-  \begingroup \mplibpostmpcatcodes \mplibdoreplacenewlinebr}
-\begingroup\lccode`\~=`\^^M \lowercase{\endgroup
-  \def\mplibdoreplacenewlinebr#1^^J{\endgroup\scantextokens{{}#1~}}}
-%    \end{macrocode}
-%
 %    The Plain-specific stuff.
 %    \begin{macrocode}
 \bgroup\expandafter\expandafter\expandafter\egroup
 \expandafter\ifx\csname selectfont\endcsname\relax
-\def\mplibreplacenewlinecs{%
-  \begingroup \mplibpostmpcatcodes \mplibdoreplacenewlinecs}
-\begingroup\lccode`\~=`\^^M \lowercase{\endgroup
-  \def\mplibdoreplacenewlinecs#1^^J{\endgroup\scantextokens{\relax#1~}}}
 \def\mplibcode{%
-  \mplibstartlineno\inputlineno
   \begingroup
   \begingroup
   \mplibsetupcatcodes
@@ -2057,7 +2041,6 @@
   \endgroup
   \directlua{luamplib.process_mplibcode([===[\unexpanded{#1}]===])}%
   \endgroup
-  \ifnum\mplibstartlineno<\inputlineno\expandafter\mplibreplacenewlinecs\fi
 }
 \else
 %    \end{macrocode}
@@ -2065,8 +2048,7 @@
 %    The \LaTeX-specific part: a new environment.
 %    \begin{macrocode}
 \newenvironment{mplibcode}{%
-  \global\mplibstartlineno\inputlineno
-  \toks@{}\ltxdomplibcode
+  \mplibtmptoks{}\ltxdomplibcode
 }{}
 \def\ltxdomplibcode{%
   \begingroup
@@ -2076,16 +2058,14 @@
 \def\mplib at mplibcode{mplibcode}
 \long\def\ltxdomplibcodeindeed#1\end#2{%
   \endgroup
-  \toks@\expandafter{\the\toks@#1}%
+  \mplibtmptoks\expandafter{\the\mplibtmptoks#1}%
   \def\mplibtemp at a{#2}%
   \ifx\mplib at mplibcode\mplibtemp at a
-    \directlua{luamplib.process_mplibcode([===[\the\toks@]===])}%
+    \directlua{luamplib.process_mplibcode([===[\the\mplibtmptoks]===])}%
     \end{mplibcode}%
-    \ifnum\mplibstartlineno<\inputlineno
-      \expandafter\expandafter\expandafter\mplibreplacenewlinebr
-    \fi
   \else
-    \toks@\expandafter{\the\toks@\end{#2}}\expandafter\ltxdomplibcode
+    \mplibtmptoks\expandafter{\the\mplibtmptoks\end{#2}}%
+    \expandafter\ltxdomplibcode
   \fi
 }
 \fi
@@ -2119,7 +2099,6 @@
 \newtoks\everymplibtoks
 \newtoks\everyendmplibtoks
 \protected\def\everymplib{%
-  \mplibstartlineno\inputlineno
   \begingroup
   \mplibsetupcatcodes
   \mplibdoeverymplib
@@ -2127,10 +2106,8 @@
 \long\def\mplibdoeverymplib#1{%
   \endgroup
   \everymplibtoks{#1}%
-  \ifnum\mplibstartlineno<\inputlineno\expandafter\mplibreplacenewlinebr\fi
 }
 \protected\def\everyendmplib{%
-  \mplibstartlineno\inputlineno
   \begingroup
   \mplibsetupcatcodes
   \mplibdoeveryendmplib
@@ -2138,7 +2115,6 @@
 \long\def\mplibdoeveryendmplib#1{%
   \endgroup
   \everyendmplibtoks{#1}%
-  \ifnum\mplibstartlineno<\inputlineno\expandafter\mplibreplacenewlinebr\fi
 }
 %    \end{macrocode}
 %
@@ -2220,6 +2196,7 @@
 %    We encapsulate the litterals.
 %    \begin{macrocode}
 \def\mplibstarttoPDF#1#2#3#4{%
+  \prependtomplibbox
   \hbox\bgroup
   \xdef\MPllx{#1}\xdef\MPlly{#2}%
   \xdef\MPurx{#3}\xdef\MPury{#4}%

Modified: trunk/Master/texmf-dist/tex/luatex/luamplib/luamplib.lua
===================================================================
--- trunk/Master/texmf-dist/tex/luatex/luamplib/luamplib.lua	2019-12-11 21:54:32 UTC (rev 53098)
+++ trunk/Master/texmf-dist/tex/luatex/luamplib/luamplib.lua	2019-12-11 21:54:44 UTC (rev 53099)
@@ -11,8 +11,8 @@
 
 luatexbase.provides_module {
   name          = "luamplib",
-  version       = "2.20.2",
-  date          = "2019/10/11",
+  version       = "2.20.4",
+  date          = "2019/12/11",
   description   = "Lua package to typeset Metapost with LuaTeX's MPLib.",
 }
 

Modified: trunk/Master/texmf-dist/tex/luatex/luamplib/luamplib.sty
===================================================================
--- trunk/Master/texmf-dist/tex/luatex/luamplib/luamplib.sty	2019-12-11 21:54:32 UTC (rev 53098)
+++ trunk/Master/texmf-dist/tex/luatex/luamplib/luamplib.sty	2019-12-11 21:54:44 UTC (rev 53099)
@@ -14,7 +14,7 @@
 \else
   \NeedsTeXFormat{LaTeX2e}
   \ProvidesPackage{luamplib}
-    [2019/10/11 v2.20.2 mplib package for LuaTeX]
+    [2019/12/11 v2.20.4 mplib package for LuaTeX]
   \ifx\newluafunction\@undefined
   \input ltluatex
   \fi
@@ -40,30 +40,18 @@
     \write128{}
   \fi
 \fi
-\def\mplibforcehmode{\let\mplibhmodeornot\leavevmode}
-\def\mplibnoforcehmode{\let\mplibhmodeornot\relax}
+\def\mplibforcehmode{\let\prependtomplibbox\leavevmode}
+\def\mplibnoforcehmode{\let\prependtomplibbox\relax}
 \mplibnoforcehmode
 \def\mplibsetupcatcodes{%
-  \mplibhmodeornot %catcode`\{=12 %catcode`\}=12
+  %catcode`\{=12 %catcode`\}=12
   \catcode`\#=12 \catcode`\^=12 \catcode`\~=12 \catcode`\_=12
-  \catcode`\&=12 \catcode`\$=12 \catcode`\%=12 \catcode`\^^M=12 \endlinechar=10
+  \catcode`\&=12 \catcode`\$=12 \catcode`\%=12 \catcode`\^^M=12
 }
 \def\mplibputtextbox#1{\vbox to 0pt{\vss\hbox to 0pt{\raise\dp#1\copy#1\hss}}}
-\newcount\mplibstartlineno
-\def\mplibpostmpcatcodes{%
-  \catcode`\{=12 \catcode`\}=12 \catcode`\#=12 \catcode`\%=12 }
-\def\mplibreplacenewlinebr{%
-  \begingroup \mplibpostmpcatcodes \mplibdoreplacenewlinebr}
-\begingroup\lccode`\~=`\^^M \lowercase{\endgroup
-  \def\mplibdoreplacenewlinebr#1^^J{\endgroup\scantextokens{{}#1~}}}
 \bgroup\expandafter\expandafter\expandafter\egroup
 \expandafter\ifx\csname selectfont\endcsname\relax
-\def\mplibreplacenewlinecs{%
-  \begingroup \mplibpostmpcatcodes \mplibdoreplacenewlinecs}
-\begingroup\lccode`\~=`\^^M \lowercase{\endgroup
-  \def\mplibdoreplacenewlinecs#1^^J{\endgroup\scantextokens{\relax#1~}}}
 \def\mplibcode{%
-  \mplibstartlineno\inputlineno
   \begingroup
   \begingroup
   \mplibsetupcatcodes
@@ -73,12 +61,10 @@
   \endgroup
   \directlua{luamplib.process_mplibcode([===[\unexpanded{#1}]===])}%
   \endgroup
-  \ifnum\mplibstartlineno<\inputlineno\expandafter\mplibreplacenewlinecs\fi
 }
 \else
 \newenvironment{mplibcode}{%
-  \global\mplibstartlineno\inputlineno
-  \toks@{}\ltxdomplibcode
+  \mplibtmptoks{}\ltxdomplibcode
 }{}
 \def\ltxdomplibcode{%
   \begingroup
@@ -88,16 +74,14 @@
 \def\mplib at mplibcode{mplibcode}
 \long\def\ltxdomplibcodeindeed#1\end#2{%
   \endgroup
-  \toks@\expandafter{\the\toks@#1}%
+  \mplibtmptoks\expandafter{\the\mplibtmptoks#1}%
   \def\mplibtemp at a{#2}%
   \ifx\mplib at mplibcode\mplibtemp at a
-    \directlua{luamplib.process_mplibcode([===[\the\toks@]===])}%
+    \directlua{luamplib.process_mplibcode([===[\the\mplibtmptoks]===])}%
     \end{mplibcode}%
-    \ifnum\mplibstartlineno<\inputlineno
-      \expandafter\expandafter\expandafter\mplibreplacenewlinebr
-    \fi
   \else
-    \toks@\expandafter{\the\toks@\end{#2}}\expandafter\ltxdomplibcode
+    \mplibtmptoks\expandafter{\the\mplibtmptoks\end{#2}}%
+    \expandafter\ltxdomplibcode
   \fi
 }
 \fi
@@ -121,7 +105,6 @@
 \newtoks\everymplibtoks
 \newtoks\everyendmplibtoks
 \protected\def\everymplib{%
-  \mplibstartlineno\inputlineno
   \begingroup
   \mplibsetupcatcodes
   \mplibdoeverymplib
@@ -129,10 +112,8 @@
 \long\def\mplibdoeverymplib#1{%
   \endgroup
   \everymplibtoks{#1}%
-  \ifnum\mplibstartlineno<\inputlineno\expandafter\mplibreplacenewlinebr\fi
 }
 \protected\def\everyendmplib{%
-  \mplibstartlineno\inputlineno
   \begingroup
   \mplibsetupcatcodes
   \mplibdoeveryendmplib
@@ -140,7 +121,6 @@
 \long\def\mplibdoeveryendmplib#1{%
   \endgroup
   \everyendmplibtoks{#1}%
-  \ifnum\mplibstartlineno<\inputlineno\expandafter\mplibreplacenewlinebr\fi
 }
 \def\mplibnumbersystem#1{\directlua{
   local t = "#1"
@@ -196,6 +176,7 @@
 }}
 \ifx\mplibscratchbox\undefined \newbox\mplibscratchbox \fi
 \def\mplibstarttoPDF#1#2#3#4{%
+  \prependtomplibbox
   \hbox\bgroup
   \xdef\MPllx{#1}\xdef\MPlly{#2}%
   \xdef\MPurx{#3}\xdef\MPury{#4}%



More information about the tex-live-commits mailing list