\documentclass{article} \usepackage{luamplib} \everymplib{ beginfig(0); } \everyendmplib{ endfig; } \begin{document} \tracingcommands1 A% \begin{mplibcode} %% test all printable ascii chars in comments %% ( 2 < F P Z d n x %% ) 3 = G Q [ e o y %% * 4 > H R \ f p z %% ! + 5 ? I S ] g q { %% " , 6 @ J T ^ h r | %% # - 7 A K U _ i s } %% $ . 8 B L V ` j t ~ %% % / 9 C M W a k u DEL %% & 0 : D N X b l v %% ยด 1 ; E O Y c m w fill fullcircle scaled 20; %% actual to make sure it works \end{mplibcode}% B\par \everymplib{}\everyendmplib{}% reset toks A% \begin{mplibcode} verbatimtex \lower.2em etex beginfig(0); draw origin--(1cm,0) withcolor red; draw btex g etex withcolor blue; endfig; beginfig(18); numeric u; u = 1cm; draw (0,2u)--(0,0)--(4u,0); pickup pencircle scaled 1pt; draw (0,0){up} for i=1 upto 8: ..(i/2,sqrt(i/2))*u endfor; label.lrt(btex $\sqrt x$ etex, (3,sqrt 3)*u); label.bot(btex $x$ etex, (2u,0)); label.lft(btex $y$ etex, (0,u)); endfig; \end{mplibcode}% B\par A% \begin{mplibcode} beginfig(2); numeric u; u=1cm; z1=-z2=(-u,0); for i = 1 upto 3: draw z1..(0, i*u)..z2; label.top(TEX("$e_{" & decimal(i) & "}$"), (0, i*u)) withcolor blue; endfor; endfig; \end{mplibcode}% B\par \mplibsetformat{metafun}% \begin{mplibcode} verbatimtex \moveright 0.4\hsize etex beginfig(0); path p; p:= fullcircle scaled 2cm yshifted .5cm; fill p withcolor transparent("normal", 0.5, red); fill p rotated 120 withcolor transparent("normal", 0.5, green); fill p rotated 240 withcolor transparent("normal", 0.5, blue); endfig; verbatimtex \leavevmode etex picture p; p := btex MetaPost etex scaled 2; beginfig(1); linear_shade(bbox p,0,blue,.7white); draw p withcolor white; endfig; verbatimtex \kern10pt etex beginfig(2); circular_shade(bbox p,0,blue,.7white); draw p withcolor white; endfig; \end{mplibcode}% \newbox\mympbox \begin{mplibcode} verbatimtex \global\setbox\mympbox etex beginfig(0); breadth=.667\mpdim\linewidth; height=2pt; x1=0; x2=x6=.333x4; x5=x3=.667x4; x4=breadth; y1=y4=height/2; y2=y3=height; y5=y6=0; fill z1--z2--z3--z4--z5--z6--cycle; endfig; \end{mplibcode}% \copy\mympbox \copy\mympbox \copy\mympbox \copy\mympbox \mplibnumbersystem{double}% \begin{mplibcode} beginfig(0); u := 10**5*(10**-4); draw unitsquare scaled u; endfig; \end{mplibcode}% \end{document}