1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
|
\input miniltx
\input color
\definecolor{orange}{rgb}{1,0.5,0}
\input luamplib.sty
\everymplib{ beginfig(0); }\everyendmplib{ endfig; }
\tracingcommands1
A%
\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;
\endmplibcode
B\par
\everymplib{}\everyendmplib{}% reset toks
A%
\mplibcode
verbatimtex \lower.2em etex
beginfig(0);
draw origin--(1cm,0) withcolor red;
draw btex g etex withcolor blue;
draw btex\tracingcommands0 multi
line
tex code
100 \% color
etex shifted (20,0);
draw textext("\tracingcommands0 textext 50\% color") shifted (10,-10) withcolor .5white;
draw bbox currentpicture;
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;
\endmplibcode
B\par
A%
\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 \mpcolor{orange};
endfor;
endfig;
\endmplibcode
B\par
\mplibsetformat{metafun}%
\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;
\endmplibcode
\newbox\mympbox
\mplibcode
verbatimtex \global\setbox\mympbox etex
beginfig(0);
breadth=.667\mpdim\hsize;
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;
\endmplibcode
\copy\mympbox
\copy\mympbox
\copy\mympbox
\copy\mympbox
\mplibnumbersystem{double}%
\mplibcode
beginfig(0);
u := 10**5*(10**-4);
draw unitsquare scaled u;
endfig;
\endmplibcode
\mplibsetformat{plain}%
\mplibcode
input graph;
beginfig(0);
draw begingraph(100,100);
gdraw (10,10)--(30,35)--(50,25)--(70,80)--(90,90);
autogrid(otick.bot,);
for y=20,40,60,80:
grid.lft(format("%e",1000y), y) withcolor .85white;
endfor
endgraph;
endfig;
\endmplibcode
\mplibtextextlabel{enable}%
\mplibcode
beginfig(0);
dotlabel.rt("$\sqrt2$",origin);
endfig;
\endmplibcode
\leavevmode
\mplibcode
D := sqrt(2)**7;
beginfig(0);
draw fullcircle scaled D;
VerbatimTeX("\gdef\Dia{" & decimal D & "}");
endfig;
\endmplibcode
diameter:\Dia bp.%
\mplibcode
vardef rotatedlabel@#(expr str, loc, angl) =
draw thelabel@#(str, loc) rotatedaround(loc, angl)
enddef;
beginfig(1);
rotatedlabel.top(textext("Rotated!"), origin, 45);
endfig;
\endmplibcode
\bye
|