summaryrefslogtreecommitdiff
path: root/macros/luatex
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-12-12 03:01:35 +0000
committerNorbert Preining <norbert@preining.info>2019-12-12 03:01:35 +0000
commit867fe7fec2734700356f0f80dbfcad265a6e4e54 (patch)
tree731b40e40f095a2356105f67751e5eb90b0c77ff /macros/luatex
parente22515f37100cb2802961f6a7cb76c8a22a118db (diff)
CTAN sync 201912120301
Diffstat (limited to 'macros/luatex')
-rw-r--r--macros/luatex/generic/luamplib/NEWS4
-rw-r--r--macros/luatex/generic/luamplib/luamplib.dtx57
-rw-r--r--macros/luatex/generic/luamplib/luamplib.pdfbin149508 -> 148905 bytes
-rw-r--r--macros/luatex/generic/luamplib/test-luamplib-latex.tex9
-rw-r--r--macros/luatex/generic/luamplib/test-luamplib-plain.tex7
5 files changed, 32 insertions, 45 deletions
diff --git a/macros/luatex/generic/luamplib/NEWS b/macros/luatex/generic/luamplib/NEWS
index 338804cbd7..109cb4ffcb 100644
--- a/macros/luatex/generic/luamplib/NEWS
+++ b/macros/luatex/generic/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/macros/luatex/generic/luamplib/luamplib.dtx b/macros/luatex/generic/luamplib/luamplib.dtx
index c93ff8c829..e683a7a2f4 100644
--- a/macros/luatex/generic/luamplib/luamplib.dtx
+++ b/macros/luatex/generic/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/macros/luatex/generic/luamplib/luamplib.pdf b/macros/luatex/generic/luamplib/luamplib.pdf
index 8d3fc8f72b..7ddfb31505 100644
--- a/macros/luatex/generic/luamplib/luamplib.pdf
+++ b/macros/luatex/generic/luamplib/luamplib.pdf
Binary files differ
diff --git a/macros/luatex/generic/luamplib/test-luamplib-latex.tex b/macros/luatex/generic/luamplib/test-luamplib-latex.tex
index 237a289748..3e53eb2662 100644
--- a/macros/luatex/generic/luamplib/test-luamplib-latex.tex
+++ b/macros/luatex/generic/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/macros/luatex/generic/luamplib/test-luamplib-plain.tex b/macros/luatex/generic/luamplib/test-luamplib-plain.tex
index 2161cf2f76..b2be4bece1 100644
--- a/macros/luatex/generic/luamplib/test-luamplib-plain.tex
+++ b/macros/luatex/generic/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);