MetaFun - Pragma ADE
MetaFun - Pragma ADE MetaFun - Pragma ADE
270 Defining styles Adaptive buttons
13 A few applications For those who need to be inspired, we will demonstrate how METAPOST can be used to enhance your document with simple graphics. In these examples we will try to be not too clever, simply because we lack the experience to be that clever. The real tricks can be found in the files that come with METAPOST. 13.1 Simple drawings In the words of John Hobby, the creator of METAPOST, “METAPOST is particularly well--suited for generating figures for technical documents where some aspects of a picture may be controlled by mathematical or geometrical constraints that are best expressed symbolically. In other words, METAPOST is not meant to take the place of a freehand drawing tool or even an interactive graphics editor”. An example of such a picture is the following one, which is dedicated to David Arnold, who asked me once how to draw a spring. So, imagine that we want to draw a schematic view of a system of four springs. A rather natural way to define such a system is: z1 = (+2cm,0) ; z2 = (0,+2cm) ; z3 = (-2cm,0) ; z4 = (0,-2cm) ; pickup pencircle scaled 1.5pt ; drawoptions (withcolor .625red) ; draw spring (z1, z2, .75cm, 2, 10) ; draw z1 -- 1.5 z1 ; draw spring (z2, z3, .75cm, 2, 9) ; draw z2 -- 1.1 z2 ; draw spring (z3, z4, .75cm, 2, 8) ; draw z3 -- 1.5 z3 ; draw spring (z4, z1, .75cm, 2, 7) ; draw z4 -- 1.1 z4 ; Here, the macro spring takes 5 arguments: two points, the width of the winding, the length of the connecting pieces, and the number of elements (half windings). The definition of spring is less complicated than readable. Simple drawings A few applications 271
- Page 223 and 224: Figure 9.3 By using transparent col
- Page 225 and 226: There are enough applications out t
- Page 227 and 228: Of course we could extend this LUA
- Page 229 and 230: 10 Typesetting in METAPOST It is sa
- Page 231 and 232: Meta is a female lion! Figure 10.2
- Page 233 and 234: We use the low level CONTEXT macro
- Page 235 and 236: So, now we have: M etaPostisFun! Wh
- Page 237 and 238: n := n + 1 ; len[n] := \the\wd\MPbo
- Page 239 and 240: ap := point at of RotPath ; ad := d
- Page 241 and 242: \startoverlay {\startuseMPgraphic{f
- Page 243 and 244: \startuseMPgraphic{text draw} draw
- Page 245 and 246: vsize := ypart urcorner p - ypart l
- Page 247 and 248: We are now ready for an attempt to
- Page 249 and 250: We can manipulate the heigth and de
- Page 251 and 252: \strutheight) ; % height of first l
- Page 253 and 254: w := h := 6cm ; o := 6pt ; path p ;
- Page 255 and 256: Donald Knuth has spent the past sev
- Page 257 and 258: Donald Knuth has spent the past sev
- Page 259 and 260: 11 Debugging Those familiar with CO
- Page 261 and 262: 4 3 5 2 6 1 0 7 8 You can pass opti
- Page 263 and 264: 3 4 0 2 1 Of course you may want to
- Page 265 and 266: 12 Defining styles Since the integr
- Page 267 and 268: color=gray, contrastcolor=gray, sty
- Page 269 and 270: def right_menu_button (expr nn, rr,
- Page 271 and 272: \Topic {Edward R. Tufte} \input tuf
- Page 273: A Few Nice Quotes A Simple Style De
- Page 277 and 278: vardef spring (expr a, b, w, h, n)
- Page 279 and 280: There is a numeric constant labelof
- Page 281 and 282: text text text text text text text
- Page 283 and 284: p := fullcircle scaled (2*length(lo
- Page 285 and 286: These definitions of anglebetween a
- Page 287 and 288: Because in most cases we want the l
- Page 289 and 290: γ δ β ɛ α ζ δ γ β ɛ metho
- Page 291 and 292: There are for sure more (efficient)
- Page 293 and 294: The next circle that we draw shows
- Page 295 and 296: popcurrentpicture ; enddef ; Here,
- Page 297 and 298: draw (u,i) -- (2u,i) withcolor .5wh
- Page 299 and 300: Figure 13.4 Koffka's examples of ma
- Page 301 and 302: \startbuffer[a] def start_everythin
- Page 303 and 304: pointC := circleA intersectionpoint
- Page 305 and 306: draw_basics ; draw_circles ; draw_i
- Page 307 and 308: Figure 13.6 Bisecting a line segmen
- Page 309 and 310: z1 = (0, height/2) ; z2 = (width/2-
- Page 311 and 312: The clipping path is applied by say
- Page 313 and 314: 13.8 Music sheets The next example
- Page 315 and 316: The euro symbol A few applications
- Page 317 and 318: draw i withpen pencircle scaled 1pt
- Page 319 and 320: 16 draw b withpen pencircle scaled
- Page 321 and 322: \startMPcode \includeMPgraphic{gamb
- Page 323 and 324: 14 METAFUN macros CONTEXT comes wit
13 A few applications<br />
For those who need to be inspired, we will demonstrate how METAPOST can be used to enhance your document<br />
with simple graphics. In these examples we will try to be not too clever, simply because we lack the experience<br />
to be that clever. The real tricks can be found in the files that come with METAPOST.<br />
13.1 Simple drawings<br />
In the words of John Hobby, the creator of METAPOST, “METAPOST is particularly well--suited for<br />
generating figures for technical documents where some aspects of a picture may be controlled<br />
by mathematical or geometrical constraints that are best expressed symbolically. In other words,<br />
METAPOST is not meant to take the place of a freehand drawing tool or even an interactive graphics<br />
editor”.<br />
An example of such a picture is the following one, which is dedicated to David Arnold, who asked<br />
me once how to draw a spring. So, imagine that we want to draw a schematic view of a system of<br />
four springs.<br />
A rather natural way to define such a system is:<br />
z1 = (+2cm,0) ; z2 = (0,+2cm) ;<br />
z3 = (-2cm,0) ; z4 = (0,-2cm) ;<br />
pickup pencircle scaled 1.5pt ;<br />
drawoptions (withcolor .625red) ;<br />
draw spring (z1, z2, .75cm, 2, 10) ; draw z1 -- 1.5 z1 ;<br />
draw spring (z2, z3, .75cm, 2, 9) ; draw z2 -- 1.1 z2 ;<br />
draw spring (z3, z4, .75cm, 2, 8) ; draw z3 -- 1.5 z3 ;<br />
draw spring (z4, z1, .75cm, 2, 7) ; draw z4 -- 1.1 z4 ;<br />
Here, the macro spring takes 5 arguments: two points, the width of the winding, the length of<br />
the connecting pieces, and the number of elements (half windings). The definition of spring is<br />
less complicated than readable.<br />
Simple drawings A few applications<br />
271