MetaFun - Pragma ADE
MetaFun - Pragma ADE MetaFun - Pragma ADE
224 Functions Drawing functions
10 Typesetting in METAPOST It is said that a picture tells more than a thousand words. So you might expect that text in graphics becomes superfluous. Out of experience we can tell you that this is not the case. In this chapter we explore the ways to add text to METAPOST graphics, and let you choose whether or not to have it typeset by TEX. 10.1 The process You can let METAPOST process text that is typeset by TEX. Such text is first embedded in the METAPOST file in the following way: btex Some text to be typeset by \TEX etex This returns a picture, but only after METAPOST has made sure that TEX has converted it into something useful. This process of conversion is slightly system dependent and even a bit obscure. Traditional METAPOST calls a program that filters the btex--etex commands, next it calls TEX by passing the output routine, in order to make sure that each piece of text ends up on its own page, and afterwards it again calls a program that converts the DVI pages into METAPOST pictures. In CONTEXT MKII, when using WEB2C, you can generate the graphics at run--time. This takes more time than processing the graphics afterwards, but has the advantage that TEX knows immediately what graphic it is dealing with. When enabled, CONTEXT will call either METAPOST, or, when the graphic contains btex--etex commands, call TEXEXEC, which in turn makes sure that the right auxiliary programs are executed. In CONTEXT MKIV you won't notice this at all as there everything is tightly integrated with LUATEX's MPLIB. 10.2 Environments TEXEXEC CONTEXT METAPOST TEXEXEC CONTEXT METAPOST Figure 10.1 How TEX and METAPOST work together. In case you want to pass code that is shared by all btex--etex pictures, METAPOST provides: verbatimtex \DefineSomeCommands etex ; However, in CONTEXT one has a better mechanism available. In CONTEXT MKII the advised method is passing environments. The best way to pass them is the following. As an example we switch to the 15 basic POSTSCRIPT fonts. The process Typesetting in METAPOST 225
- Page 177 and 178: There are two more operators: inner
- Page 179 and 180: 7 Shapes, symbols and buttons One c
- Page 181 and 182: Table 7.1 demonstrates how scratch
- Page 183 and 184: for i := 1 upto \MPvar{n} : xpos :=
- Page 185 and 186: This table is defined as: \bTABLE[f
- Page 187 and 188: Since we have collected some nice b
- Page 189 and 190: 8 Special effects Sometimes we want
- Page 191 and 192: Because of this implementation, sha
- Page 193 and 194: test_shade(origin shifted (.25cm,0)
- Page 195 and 196: fill p shifted (3cm,0) withcolor .5
- Page 197 and 198: \definecolor [tred] [r=1,t=.5,a=exc
- Page 199 and 200: Figure 8.4 Another clipped cow. \pl
- Page 201 and 202: withpen pencircle scaled 4mm withco
- Page 203 and 204: Because this graphic is the result
- Page 205 and 206: The resulting PDF file can be inclu
- Page 207 and 208: Including another METAPOST graphic,
- Page 209 and 210: After these examples your are proba
- Page 211 and 212: In this graphic, we have two text f
- Page 213 and 214: } {}} Here we feed some MATHML int
- Page 215 and 216: 9 Functions METAPOST provides a wid
- Page 217 and 218: 9.2 Grids Some day you may want to
- Page 219 and 220: 13 13 13 13 Figure 9.1 Quick and di
- Page 221 and 222: 2 − ×10 1 − 1 0×100 Figure 9.
- Page 223 and 224: Figure 9.3 By using transparent col
- Page 225 and 226: There are enough applications out t
- Page 227: Of course we could extend this LUA
- 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 and 274: A Few Nice Quotes A Simple Style De
- Page 275 and 276: 13 A few applications For those who
- Page 277 and 278: vardef spring (expr a, b, w, h, n)
224<br />
Functions Drawing functions