- Page 1: Hans Hagen metafun context mkiv
- Page 6 and 7: 2 Introduction and therefore to CON
- Page 8 and 9: 4 Content 9 Functions . . . . . . .
- Page 10 and 11: 6 Conventions By default, CONTEXT h
- Page 12 and 13: 8 This path is constructed out of f
- Page 14 and 15: 10 This time we used the path: (1.5
- Page 16 and 17: 12 Note that rotated 15 is equivale
- Page 18 and 19: 14 A zscaled specification takes a
- Page 20 and 21: 16 0 4 1 3 "z0---z1---z2---z3---cyc
- Page 22 and 23: 18 0 1 The following path is a clos
- Page 24 and 25: 20 The new (sub)path is a new path
- Page 26 and 27: 22 1 "(z0..z1..z2..z3) cutbefore po
- Page 28 and 29: 24 The dir command returns an unit
- Page 30 and 31: 26 fill (0,0)--(ww,0)--(ww,hh)--(w,
- Page 32 and 33: 28 often, you may expect draw and f
- Page 34 and 35: 30 i_111_222 := 1cm ; i_[111]_[222]
- Page 36 and 37: 32 numeric done[][], i, j, n ; n :=
- Page 38 and 39: 34 vardef randomscaledpath(expr p,
- Page 40 and 41: 36 1.11 Pens min_u enddef ; The spe
- Page 42 and 43: 38 You can define such a pen yourse
- Page 44 and 45: 40 1.13 Colors So far, we have seen
- Page 46 and 47: 42 You can of course rotate, slant
- Page 48 and 49: 44 \defineMPinstance [solvers] [for
- Page 50 and 51: 46 \startMPdefinitions{solvers} ang
- Page 52 and 53:
48 1.0 / 1.0 0.8 / 1.0 0.6 / 1.0 0.
- Page 54 and 55:
50 A bounding box is defined by its
- Page 56 and 57:
52 The smoothed operation is a less
- Page 58 and 59:
54 Probably less usefull (although
- Page 60 and 61:
56 Often I make such helpers in the
- Page 62 and 63:
58 drawpath p ; drawpoints p ; p :=
- Page 64 and 65:
60 1.19 Cutting and pasting When en
- Page 66 and 67:
62 By using a vardef we hide the in
- Page 68 and 69:
64 Sometimes it's handy to temporar
- Page 70 and 71:
66 We can view this file in a POSTS
- Page 72 and 73:
68 4 5 pickup pencircle scaled .5cm
- Page 74 and 75:
70 There is a subtle point in filli
- Page 76 and 77:
72 draw fullcircle scaled 100 ; dra
- Page 78 and 79:
74 However, when we combine such gr
- Page 80 and 81:
76 Here, the parameter t runs from
- Page 82 and 83:
78 points first order points second
- Page 84 and 85:
80 z6 z7 z1 z5 z4 z2 z3 z7 z6 z1 z5
- Page 86 and 87:
82 It is surprisingly difficult to
- Page 88 and 89:
84 Figure 2.5 Circles with minimize
- Page 90 and 91:
86 Curves finally are made up out o
- Page 92 and 93:
88 sample(z1 .. tension (.75+i) ..
- Page 94 and 95:
90 sample (z1 {curl 0} .. z2 .. {cu
- Page 96 and 97:
92 MetaFun Because the transformati
- Page 98 and 99:
94 This rectangle is a scaled insta
- Page 100 and 101:
96 We draw this path using a non st
- Page 102 and 103:
98 Another case when top and friend
- Page 104 and 105:
100 2.9 Directions Quite often you
- Page 106 and 107:
102 These circles were drawn using:
- Page 108 and 109:
104 draw fullcircle withpen pencirc
- Page 110 and 111:
106 also i fi withcolor white-(redp
- Page 112 and 113:
108 There are more cases where the
- Page 114 and 115:
110 the language. Occasionally you
- Page 116 and 117:
112 An alternative method is to sep
- Page 118 and 119:
114 \defineoverlay[my graphic][\MyG
- Page 120 and 121:
116 beginfig(21) ; draw fullsquare
- Page 122 and 123:
118 \startMPpage % Your mp code goe
- Page 124 and 125:
120 The previous example uses a pur
- Page 126 and 127:
122 c=1 y=.3 k=.3 c=.9 y=.15 c=.25
- Page 128 and 129:
124 In this case the page=1 specifi
- Page 130 and 131:
126 Embedded graphics Managing reso
- Page 132 and 133:
128 In this case, it would have mad
- Page 134 and 135:
130 4.4 Foregrounds The overlay sys
- Page 136 and 137:
132 As you may know, TEX's ambassad
- Page 138 and 139:
134 ... etex, the TEX code in texte
- Page 140 and 141:
136 \startMPcode picture p ; p := \
- Page 142 and 143:
138 \defineoverlay[FunnyFrame][\use
- Page 144 and 145:
140 OverlayHeight \overlayheight cu
- Page 146 and 147:
142 draw p shifted (0,i) withpen pe
- Page 148 and 149:
144 paragraph is typeset, but in th
- Page 150 and 151:
146 \defineoverlay [foregraphics] [
- Page 152 and 153:
148 background overlay a text, grap
- Page 154 and 155:
150 \setlayer[BackLayer][x=15cm,y=5
- Page 156 and 157:
152 option test show positioning in
- Page 158 and 159:
154 Positional graphics Complex tex
- Page 160 and 161:
156 Since we want to teach a bit of
- Page 162 and 163:
158 top header text footer bottom e
- Page 164 and 165:
160 COPYRIGHT 6.2 Setting up backgr
- Page 166 and 167:
162 offset=\bodyfontsize, before={\
- Page 168 and 169:
164 BottomDistance BottomHeight hor
- Page 170 and 171:
166 \startuseMPgraphic{page} StartP
- Page 172 and 173:
168 8 8 8 Edward R. Tufte We thrive
- Page 174 and 175:
170 10 10 10 Edward R. Tufte We thr
- Page 176 and 177:
172 This graphic is generated as fo
- Page 178 and 179:
174 Page backgrounds Bleeding
- Page 180 and 181:
176 paragraph, being the graphic. T
- Page 182 and 183:
178 Because we want to be sure that
- Page 184 and 185:
180 pickup pencircle xscaled (size/
- Page 186 and 187:
182 meta:hash:linecolor=darkyellow]
- Page 188 and 189:
184 Shapes, symbols and buttons Sym
- Page 190 and 191:
186 We still have to define the gra
- Page 192 and 193:
188 direction and magnitude of the
- Page 194 and 195:
190 12 such a feature at a higher a
- Page 196 and 197:
192 13 SampleText ("\colored[a=1,t=
- Page 198 and 199:
194 Hello Hello 8.3 Clipping In thi
- Page 200 and 201:
196 We start in the top left corner
- Page 202 and 203:
198 The definition of peepholed is
- Page 204 and 205:
200 As long as you don't mess aroun
- Page 206 and 207:
202 fill fullcircle scaled 2cm with
- Page 208 and 209:
204 loadfigure "gracht.mp" number 1
- Page 210 and 211:
206 By default the shapes are fille
- Page 212 and 213:
208 withdrawcolor .625red withpen p
- Page 214 and 215:
210 Special effects Outline fonts
- Page 216 and 217:
212 decr(x,n) decrement x by n incr
- Page 218 and 219:
214 draw hlingrid(0, 10, 1, 3cm, 3c
- Page 220 and 221:
216 9.3 Drawing functions Today the
- Page 222 and 223:
218 function(2,".5log(x)","x",1,10,
- Page 224 and 225:
220 If we use the exclusion method
- Page 226 and 227:
222 Writing such LUA functions is n
- Page 228 and 229:
224 Functions Drawing functions
- Page 230 and 231:
226 \startMPenvironment \usetypescr
- Page 232 and 233:
228 We let the bodyfont match the f
- Page 234 and 235:
230 endfor ; \stopMPdrawing This co
- Page 236 and 237:
232 Placing the pictures is now rat
- Page 238 and 239:
234 Does it wor k ok? D o e s i t w
- Page 240 and 241:
236 We now follow som e arbitrar y
- Page 242 and 243:
238 10.5 Talking to TEX Sometimes,
- Page 244 and 245:
240 \startuseMPgraphic{text draw} d
- Page 246 and 247:
242 The offset is not optimal. Note
- Page 248 and 249:
244 shifted (0,-strutdepth)--cycle)
- Page 250 and 251:
246 We have to adapt the for--loop
- Page 252 and 253:
248 an additional horizontal and ve
- Page 254 and 255:
250 Donald Knuth has spent the past
- Page 256 and 257:
252 We will surround this text with
- Page 258 and 259:
254 Typesetting in METAPOST Librari
- Page 260 and 261:
256 You can deduce the direction of
- Page 262 and 263:
258 By default, the ticks are place
- Page 264 and 265:
260 Debugging Libraries
- Page 266 and 267:
262 edge distance. By setting the h
- Page 268 and 269:
264 Douglas R. Hofstadter t b Donal
- Page 270 and 271:
266 enddef ; \stopuseMPgraphic The
- Page 272 and 273:
268 alternative := alternative mod
- Page 274 and 275:
270 Defining styles Adaptive button
- Page 276 and 277:
272 def spring (expr a, b, w, h, n)
- Page 278 and 279:
274 Or even (watch how we use the n
- Page 280 and 281:
276 Now, what happens when we want
- Page 282 and 283:
278 p := fullcircle scaled (2*lengt
- Page 284 and 285:
280 pair uv ; pickup pencircle scal
- Page 286 and 287:
282 (unitvector(endofa-common){(end
- Page 288 and 289:
284 γ δ β ɛ α ζ Multiples of
- Page 290 and 291:
286 pair b_r, b_g, g_r, g_b ; numer
- Page 292 and 293:
288 yy := cc rotatedaround(origin,1
- Page 294 and 295:
290 This rather nice circle is defi
- Page 296 and 297:
292 currentpicture := currentpictur
- Page 298 and 299:
294 \startuseMPgraphic{third} \incl
- Page 300 and 301:
296 addto currentpicture also q shi
- Page 302 and 303:
298 15 We use \ruledhbox to show th
- Page 304 and 305:
300 C A B D The following code draw
- Page 306 and 307:
302 A B A B A B A few applications
- Page 308 and 309:
304 Which method is used, depends o
- Page 310 and 311:
306 If we combine these two segment
- Page 312 and 313:
308 The complete logo definition is
- Page 314 and 315:
310 Because we are still drawing so
- Page 316 and 317:
312 boolean trace_euro ; trace_euro
- Page 318 and 319:
314 Of course it would be best to d
- Page 320 and 321:
316 \startMPcode \includeMPgraphic{
- Page 322 and 323:
318 A few applications Killing time
- Page 324 and 325:
320 METAFUN macros Killing time
- Page 326 and 327:
322 〈subexpression〉 → 〈tert
- Page 328 and 329:
324 〈nullary op〉 → false | no
- Page 330 and 331:
326 〈on/off clause〉 → on 〈n
- Page 332 and 333:
328 〈parameter tokens〉 → 〈p
- Page 334 and 335:
330 〈drawing option〉 → withco
- Page 336 and 337:
332 〈pseudo function〉 → defin
- Page 338 and 339:
334 The document style is not that
- Page 340 and 341:
336 pair — pair (0,0)..(.75,0)---
- Page 342 and 343:
338 right (0,0)right..(1,1) metapos
- Page 344 and 345:
340 unitdiamond unitdiamond metafun
- Page 346 and 347:
342 flex(pair,pair,pair) flex ((0,0
- Page 348 and 349:
344 path paralleled distance ((0,0)
- Page 350 and 351:
346 path crossed size fullcircle sc
- Page 352 and 353:
348 path topenlarged numeric fullsq
- Page 354 and 355:
350 path lrenlarged pair fullcircle
- Page 356 and 357:
352 path ulmoved pair fullcircle ul
- Page 358 and 359:
354 path cutends .1 fullcircle cute
- Page 360 and 361:
356 rightboundary path rightboundar
- Page 362 and 363:
358 point numeric along path point
- Page 364 and 365:
360 withshade numeric Shades need t
- Page 366 and 367:
362 unfill unfill fullcircle metapo
- Page 368 and 369:
364 C.5 Text inverted picture inver
- Page 370 and 371:
366 graphictext string ... graphict
- Page 372 and 373:
368 D.4 Tools There are more manual
- Page 374:
370 s scaling 73 shading 185 shifti