summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Master/texmf-dist/doc/luatex/luamplib/NEWS4
-rw-r--r--Master/texmf-dist/doc/luatex/luamplib/luamplib.pdfbin149508 -> 148905 bytes
-rw-r--r--Master/texmf-dist/doc/luatex/luamplib/test-luamplib-latex.tex9
-rw-r--r--Master/texmf-dist/doc/luatex/luamplib/test-luamplib-plain.tex7
-rw-r--r--Master/texmf-dist/source/luatex/luamplib/luamplib.dtx57
-rw-r--r--Master/texmf-dist/tex/luatex/luamplib/luamplib.lua4
-rw-r--r--Master/texmf-dist/tex/luatex/luamplib/luamplib.sty41
7 files changed, 45 insertions, 77 deletions
diff --git a/Master/texmf-dist/doc/luatex/luamplib/NEWS b/Master/texmf-dist/doc/luatex/luamplib/NEWS
index 338804cbd70..109cb4ffcb9 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
+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)
diff --git a/Master/texmf-dist/doc/luatex/luamplib/luamplib.pdf b/Master/texmf-dist/doc/luatex/luamplib/luamplib.pdf
index 8d3fc8f72b0..7ddfb315051 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 237a2897480..3e53eb26624 100644
--- a/Master/texmf-dist/doc/luatex/luamplib/test-luamplib-latex.tex
+++ b/Master/texmf-dist/doc/luatex/luamplib/test-luamplib-latex.tex
@@ -31,7 +31,7 @@ draw origin--(1cm,0) withcolor \mpcolor{teal};
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 @@ for i = 1 upto 3:
endfor;
endfig;
\end{mplibcode}%
-B\par\leavevmode
+B\par\mplibforcehmode
\mplibcodeinherit{enable}%
\mplibglobaltextext{enable}%
\everymplib{ beginfig(0);}\everyendmplib{ endfig;}%
@@ -75,6 +75,7 @@ B\par\leavevmode
\begin{mplibcode}
currentpicture := pic scaled 2;
\end{mplibcode}%
+\mplibnoforcehmode
\everymplib{}\everyendmplib{}%
\mplibcodeinherit{disable}%
\mplibglobaltextext{disable}\par
@@ -101,8 +102,9 @@ endfig;
\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 @@ endfig;
\copy\mympbox
\copy\mympbox
+\mplibnoforcehmode
\mplibnumbersystem{double}%
\begin{mplibcode}
beginfig(0);
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 2161cf2f766..b2be4bece1a 100644
--- a/Master/texmf-dist/doc/luatex/luamplib/test-luamplib-plain.tex
+++ b/Master/texmf-dist/doc/luatex/luamplib/test-luamplib-plain.tex
@@ -61,7 +61,7 @@ for i = 1 upto 3:
endfor;
endfig;
\endmplibcode
-B\par\leavevmode
+B\par\mplibforcehmode
\mplibcodeinherit{enable}%
\mplibglobaltextext{enable}%
\everymplib{ beginfig(0);}\everyendmplib{ endfig;}%
@@ -73,6 +73,7 @@ B\par\leavevmode
\mplibcode
currentpicture := pic scaled 2;
\endmplibcode
+\mplibnoforcehmode
\everymplib{}\everyendmplib{}%
\mplibcodeinherit{disable}%
\mplibglobaltextext{disable}\par
@@ -99,8 +100,9 @@ endfig;
\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 @@ endfig;
\copy\mympbox
\copy\mympbox
+\mplibnoforcehmode
\mplibnumbersystem{double}%
\mplibcode
beginfig(0);
diff --git a/Master/texmf-dist/source/luatex/luamplib/luamplib.dtx b/Master/texmf-dist/source/luatex/luamplib/luamplib.dtx
index c93ff8c8290..e683a7a2f4e 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}%
- [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 @@ 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{2019/10/11 v2.20.2}
+% \date{2019/12/11 v2.20.4}
%
% \maketitle
%
@@ -206,7 +206,8 @@ See source file '\inFileName' for licencing and contact information.
% 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 @@ See source file '\inFileName' for licencing and contact information.
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 @@ luamplib.colorconverter = colorconverter
\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,17 +2008,17 @@ luamplib.colorconverter = colorconverter
%
% 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}
%
% 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 @@ luamplib.colorconverter = colorconverter
\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 @@ luamplib.colorconverter = colorconverter
\endgroup
\directlua{luamplib.process_mplibcode([===[\unexpanded{#1}]===])}%
\endgroup
- \ifnum\mplibstartlineno<\inputlineno\expandafter\mplibreplacenewlinecs\fi
}
\else
% \end{macrocode}
@@ -2065,8 +2048,7 @@ luamplib.colorconverter = colorconverter
% 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 @@ luamplib.colorconverter = colorconverter
\def\mplib@mplibcode{mplibcode}
\long\def\ltxdomplibcodeindeed#1\end#2{%
\endgroup
- \toks@\expandafter{\the\toks@#1}%
+ \mplibtmptoks\expandafter{\the\mplibtmptoks#1}%
\def\mplibtemp@a{#2}%
\ifx\mplib@mplibcode\mplibtemp@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 @@ luamplib.colorconverter = colorconverter
\newtoks\everymplibtoks
\newtoks\everyendmplibtoks
\protected\def\everymplib{%
- \mplibstartlineno\inputlineno
\begingroup
\mplibsetupcatcodes
\mplibdoeverymplib
@@ -2127,10 +2106,8 @@ luamplib.colorconverter = colorconverter
\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 @@ luamplib.colorconverter = colorconverter
\long\def\mplibdoeveryendmplib#1{%
\endgroup
\everyendmplibtoks{#1}%
- \ifnum\mplibstartlineno<\inputlineno\expandafter\mplibreplacenewlinebr\fi
}
% \end{macrocode}
%
@@ -2220,6 +2196,7 @@ luamplib.colorconverter = colorconverter
% 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}%
diff --git a/Master/texmf-dist/tex/luatex/luamplib/luamplib.lua b/Master/texmf-dist/tex/luatex/luamplib/luamplib.lua
index 69ab5cef027..2b2ac290b4c 100644
--- a/Master/texmf-dist/tex/luatex/luamplib/luamplib.lua
+++ b/Master/texmf-dist/tex/luatex/luamplib/luamplib.lua
@@ -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.",
}
diff --git a/Master/texmf-dist/tex/luatex/luamplib/luamplib.sty b/Master/texmf-dist/tex/luatex/luamplib/luamplib.sty
index 6849c6cf90f..aae75fd9632 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}
- [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@mplibcode{mplibcode}
\long\def\ltxdomplibcodeindeed#1\end#2{%
\endgroup
- \toks@\expandafter{\the\toks@#1}%
+ \mplibtmptoks\expandafter{\the\mplibtmptoks#1}%
\def\mplibtemp@a{#2}%
\ifx\mplib@mplibcode\mplibtemp@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}%