summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/luatex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2024-05-01 20:15:29 +0000
committerKarl Berry <karl@freefriends.org>2024-05-01 20:15:29 +0000
commitd7411a50466d793d9c96b148b9baf4626a1d14d2 (patch)
tree81e2ce3a51170e22a6bbdecc23493eea3f52999a /Master/texmf-dist/doc/luatex
parentab250ac510164e286c020c1b64d7ee06e9760848 (diff)
luamplib (1may24)
git-svn-id: svn://tug.org/texlive/trunk@71148 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc/luatex')
-rw-r--r--Master/texmf-dist/doc/luatex/luamplib/NEWS53
-rw-r--r--Master/texmf-dist/doc/luatex/luamplib/luamplib.pdfbin170094 -> 175518 bytes
-rw-r--r--Master/texmf-dist/doc/luatex/luamplib/test-luamplib-latex.tex4
-rw-r--r--Master/texmf-dist/doc/luatex/luamplib/test-luamplib-plain.tex79
4 files changed, 131 insertions, 5 deletions
diff --git a/Master/texmf-dist/doc/luatex/luamplib/NEWS b/Master/texmf-dist/doc/luatex/luamplib/NEWS
index f0dd1cf2f46..87f52a00661 100644
--- a/Master/texmf-dist/doc/luatex/luamplib/NEWS
+++ b/Master/texmf-dist/doc/luatex/luamplib/NEWS
@@ -1,5 +1,48 @@
History of the luamplib package
+2024/05/01 2.29.0
+
+ * provide new TeX macros to reduce typing toil.
+
+ \mpfig ... \endmpfig is roughly the abbreviation of
+ \begin{mplibcode}[@mpfig]
+ beginfig(0)
+ token list declared by \everymplib[@mpfig]
+ ...
+ token list declared by \everyendmplib[@mpfig]
+ endfig;
+ \end{mplibcode}
+
+ \mpfig* ... \endmpfig is roughly the abbreviation of
+ \begin{mplibcode}[@mpfig]
+ ...
+ \end{mplibcode}
+
+ These macros are protected and unexpandable.
+ In these macros \mpliblegacybehavior{false} is forcibly declared.
+ As both share the same instance name, MetaPost codes are inherited among them.
+ The instance name (default: @mpfig) can be changed by redefining `\mpfiginstancename'.
+
+ * instance names are allowed in plain TeX as well. The syntax is:
+
+ \mplibcode[name] ... \endmplibcode
+ \everymplib[name]{ ... }
+ \everyendmplib[name]{ ... }
+
+ These macros are now protected and unexpandable.
+
+ * provide new MetaPost operators `mplibtexcolor' and `mplibrgbtexcolor'
+ which convert TeX color expressions to MetaPost color expressions.
+ The latter one forces rgb model results (#112). For instance,
+
+ mplibtexcolor "olive" % => (0, 0, 1, 0.5)
+ mplibrgbtexcolor "olive" % => (0.5, 0.5, 0)
+
+ As spot colors are always forced to cmyk or rgb model, it is not
+ recommended to use these operators for them.
+
+ * write down MetaPost messages into the log file
+
2024/04/25 2.28.2
* direction of figure box is explicitly declared as TLT (#129)
* figure box materials are emitted in one go at the end of the figure
@@ -72,11 +115,11 @@
2024/03/01 2.26.0
* when \mplibcachedir{<dir>} is not set, default cache directory will
be in the following order:
- $TEXMFVAR/luamplib_cache
- $TEXMF_OUTPUT_DIRECTORY/luamplib_cache
- ./luamplib_cache
- $TEXMFOUTPUT/luamplib_cache
- .
+ $TEXMFVAR/luamplib_cache
+ $TEXMF_OUTPUT_DIRECTORY/luamplib_cache
+ ./luamplib_cache
+ $TEXMFOUTPUT/luamplib_cache
+ .
2024/01/25 2.25.3
* protect "..." even if textextlabel is disabled (revert part of v2.25.0)
diff --git a/Master/texmf-dist/doc/luatex/luamplib/luamplib.pdf b/Master/texmf-dist/doc/luatex/luamplib/luamplib.pdf
index 6d410a4c26c..a8cc10a03b3 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 a077f677362..52af10d72bb 100644
--- a/Master/texmf-dist/doc/luatex/luamplib/test-luamplib-latex.tex
+++ b/Master/texmf-dist/doc/luatex/luamplib/test-luamplib-latex.tex
@@ -197,6 +197,10 @@ fill unitsquare xyscaled (\mpdim\textwidth,1cm)
;
endfig;
\end{mplibcode}%
+\leavevmode
+\everymplib[@mpfig]{ drawoptions(withcolor red); }%
+\mpfig* input boxes \endmpfig
+\mpfig circleit.a(btex\tracingcommands0 Box 1 etex); drawboxed(a); \endmpfig
\tracingcommands0
\vskip 2\baselineskip
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 20773b280fe..84d7041a8d4 100644
--- a/Master/texmf-dist/doc/luatex/luamplib/test-luamplib-plain.tex
+++ b/Master/texmf-dist/doc/luatex/luamplib/test-luamplib-plain.tex
@@ -163,4 +163,83 @@ diameter:\Dia bp.%
rotatedlabel.top(textext("Rotated!"), origin, 45);
endfig;
\endmplibcode
+\par
+\mplibsetformat{metafun}%
+\mplibcode
+beginfig(1)
+fill unitsquare xyscaled (\mpdim\hsize, 1cm)
+ withshademethod "linear"
+ withshadevector (0,1)
+ withshadestep (
+ withshadefraction .5
+ withshadecolors (red,blue)
+ )
+ withshadestep (
+ withshadefraction 1
+ withshadecolors (blue,green)
+ )
+ ;
+endfig;
+\endmplibcode
+\everymplib[@mpfig]{ drawoptions(withcolor red); }%
+\mpfig* input boxes \endmpfig
+\mpfig circleit.a(btex\tracingcommands0 Box 1 etex); drawboxed(a); \endmpfig
+\tracingcommands0
+
+\vskip 2\baselineskip
+\mplibcodeinherit{disable}
+\everymplib[instanceOne]{beginfig(1);}
+\everyendmplib[instanceOne]{endfig;}
+
+\mplibcode[instanceOne]
+ picture TeX;
+ TeX := btex \TeX etex;
+a := 1cm;
+draw fullcircle scaled a;
+draw btex a circle with $d=a$ etex shifted (a,0);
+draw TeX;
+\endmplibcode
+Current instance name is: \currentmpinstancename \vskip 2\baselineskip
+
+\mplibcode[instanceTwo]
+beginfig(1);
+if not known a:
+ draw btex code is not inherited from an instance with a different name etex;
+else:
+ errmessage("Variable was inherited from a different instance");
+fi;
+endfig;
+\endmplibcode
+Current instance name is: \currentmpinstancename \vskip 2\baselineskip
+
+\mplibcode
+beginfig(1);
+if not known a:
+ draw btex code is not inherited if instance name is not listed etex;
+else:
+ errmessage("Variable was inherited from a different instance");
+fi;
+a := 1cm;
+endfig;
+\endmplibcode
+Current instance name is: \currentmpinstancename (should be empty) \vskip 2\baselineskip
+
+\mplibcode
+beginfig(1);
+if not known a:
+ draw btex code is not inherited if mplibcodeinherit is disabled and instance name is not explicitly set etex;
+else:
+ errmessage("Variable was inherited when code inheritance is turned off and instance name is not set");
+fi;
+endfig;
+\endmplibcode
+Current instance name is: \currentmpinstancename (should be empty) \vskip 2\baselineskip
+
+\mplibcode[instanceOne]
+draw unitsquare scaled a;
+draw btex a square with side $=a$, inherited from the same instance etex shifted (3/2a, 1/2a);
+ draw TeX;
+\endmplibcode
+Current instance name is: \currentmpinstancename \vskip 2\baselineskip
+
\bye