MetaFun - Pragma ADE

MetaFun - Pragma ADE MetaFun - Pragma ADE

pragma.ade.com
from pragma.ade.com More from this publisher
29.11.2012 Views

4 Content 9 Functions . . . . . . . . . . . . . . . . . . . . . 211 9.1 Overview . . . . . . . . . . . . . . . . . . . 211 9.2 Grids . . . . . . . . . . . . . . . . . . . . . . . 213 9.3 Drawing functions . . . . . . . . . . . 216 10 Typesetting in METAPOST . . . . . . 225 10.1 The process . . . . . . . . . . . . . . . . . 225 10.2 Environments . . . . . . . . . . . . . . . 225 10.3 Labels . . . . . . . . . . . . . . . . . . . . . . 226 10.4 TEX text . . . . . . . . . . . . . . . . . . . . 227 10.5 Talking to TEX . . . . . . . . . . . . . . . 238 10.6 Libraries . . . . . . . . . . . . . . . . . . . . 247 11 Debugging . . . . . . . . . . . . . . . . . . . . 255 12 Defining styles . . . . . . . . . . . . . . . . 261 12.1 Adaptive buttons . . . . . . . . . . . . 261 13 A few applications . . . . . . . . . . . . . 271 13.1 Simple drawings . . . . . . . . . . . . . 271 13.2 Free labels . . . . . . . . . . . . . . . . . . 274 13.3 Marking angles . . . . . . . . . . . . . . 279 13.4 Color circles . . . . . . . . . . . . . . . . 285 13.5 Fool yourself . . . . . . . . . . . . . . . . 292 13.6 Growing graphics . . . . . . . . . . . . 296 13.7 Simple Logos . . . . . . . . . . . . . . . . 304 13.8 Music sheets . . . . . . . . . . . . . . . . 309 13.9 The euro symbol . . . . . . . . . . . . . 310 13.10 Killing time . . . . . . . . . . . . . . . . . 314 14 METAFUN macros . . . . . . . . . . . . . 319 A METAPOST syntax . . . . . . . . . . . . . 321 A.1 Syntax diagrams . . . . . . . . . . . . . 321 A.2 Left overs . . . . . . . . . . . . . . . . . . . 331 B This document . . . . . . . . . . . . . . . . 333 C Reference . . . . . . . . . . . . . . . . . . . . . 335 C.1 Paths . . . . . . . . . . . . . . . . . . . . . . . 335 C.2 Transformations . . . . . . . . . . . . . 346 C.3 Points . . . . . . . . . . . . . . . . . . . . . . 357 C.4 Attributes . . . . . . . . . . . . . . . . . . . 359 C.5 Text . . . . . . . . . . . . . . . . . . . . . . . . 364 C.6 Graphics . . . . . . . . . . . . . . . . . . . . 366 D Literature . . . . . . . . . . . . . . . . . . . . . 367 D.1 METAFONT and METAPOST . . 367 D.2 TEX . . . . . . . . . . . . . . . . . . . . . . . . 367 D.3 CONTEXT . . . . . . . . . . . . . . . . . . 367 D.4 Tools . . . . . . . . . . . . . . . . . . . . . . . 368 D.5 Distributions . . . . . . . . . . . . . . . . 368 Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . 369

1 Conventions When reading this manual, you may be tempted to test the examples shown. This can be done in several ways. You can make a file and process that file by METAPOST. Such a file looks like: beginfig(1) ; fill fullcircle scaled 5cm withcolor red ; % a graphic endfig ; end . Don't forget the semi--colons that end the statements. If the file is saved as yourfile.mp, then the file is processed by: mpost --mem=metafun.mem yourfile The results are available in yourfile.1 and can be viewed with GHOSTSCRIPT. You don't need to close the file so reprocessing is very convenient. Alternatively you can use CONTEXT. In that case, a simple file looks like: \starttext \startMPpage fill fullcircle scaled 5cm withcolor red ; \stopMPpage \startMPpage fill unitsquare scaled 5cm withcolor red ; \stopMPpage \stoptext If the file is saved as yourfile.tex, then you can produce a PDF file with: 1 context yourfile This will use LUATEX and CONTEXT MKIV to produce a file with two pages using the built in METAPOST library with METAFUN. When you use this route you will automatically get the integrated text support shown in this manual, including OPENTYPE support. If one page is enough, you can also say: \startMPpage fill fullcircle scaled 5cm withcolor red ; \stopMPpage So when you have a running CONTEXT on your system you don't need to bother about installing METAPOST and running METAFUN. We will use lots of color. Don't worry if your red is not our red, or your yellow does not match ours. We've made color definitions to match the overall design of this document, but you should feel free to use any color of choice in the upcoming examples. We assume that you are using CONTEXT MKIV, otherwise you need to run texexec with the --mptex flag. 5 Conventions

4<br />

Content<br />

9 Functions . . . . . . . . . . . . . . . . . . . . . 211<br />

9.1 Overview . . . . . . . . . . . . . . . . . . . 211<br />

9.2 Grids . . . . . . . . . . . . . . . . . . . . . . . 213<br />

9.3 Drawing functions . . . . . . . . . . . 216<br />

10 Typesetting in METAPOST . . . . . . 225<br />

10.1 The process . . . . . . . . . . . . . . . . . 225<br />

10.2 Environments . . . . . . . . . . . . . . . 225<br />

10.3 Labels . . . . . . . . . . . . . . . . . . . . . . 226<br />

10.4 TEX text . . . . . . . . . . . . . . . . . . . . 227<br />

10.5 Talking to TEX . . . . . . . . . . . . . . . 238<br />

10.6 Libraries . . . . . . . . . . . . . . . . . . . . 247<br />

11 Debugging . . . . . . . . . . . . . . . . . . . . 255<br />

12 Defining styles . . . . . . . . . . . . . . . . 261<br />

12.1 Adaptive buttons . . . . . . . . . . . . 261<br />

13 A few applications . . . . . . . . . . . . . 271<br />

13.1 Simple drawings . . . . . . . . . . . . . 271<br />

13.2 Free labels . . . . . . . . . . . . . . . . . . 274<br />

13.3 Marking angles . . . . . . . . . . . . . . 279<br />

13.4 Color circles . . . . . . . . . . . . . . . . 285<br />

13.5 Fool yourself . . . . . . . . . . . . . . . . 292<br />

13.6 Growing graphics . . . . . . . . . . . . 296<br />

13.7 Simple Logos . . . . . . . . . . . . . . . . 304<br />

13.8 Music sheets . . . . . . . . . . . . . . . . 309<br />

13.9 The euro symbol . . . . . . . . . . . . . 310<br />

13.10 Killing time . . . . . . . . . . . . . . . . . 314<br />

14 METAFUN macros . . . . . . . . . . . . . 319<br />

A METAPOST syntax . . . . . . . . . . . . . 321<br />

A.1 Syntax diagrams . . . . . . . . . . . . . 321<br />

A.2 Left overs . . . . . . . . . . . . . . . . . . . 331<br />

B This document . . . . . . . . . . . . . . . . 333<br />

C Reference . . . . . . . . . . . . . . . . . . . . . 335<br />

C.1 Paths . . . . . . . . . . . . . . . . . . . . . . . 335<br />

C.2 Transformations . . . . . . . . . . . . . 346<br />

C.3 Points . . . . . . . . . . . . . . . . . . . . . . 357<br />

C.4 Attributes . . . . . . . . . . . . . . . . . . . 359<br />

C.5 Text . . . . . . . . . . . . . . . . . . . . . . . . 364<br />

C.6 Graphics . . . . . . . . . . . . . . . . . . . . 366<br />

D Literature . . . . . . . . . . . . . . . . . . . . . 367<br />

D.1 METAFONT and METAPOST . . 367<br />

D.2 TEX . . . . . . . . . . . . . . . . . . . . . . . . 367<br />

D.3 CONTEXT . . . . . . . . . . . . . . . . . . 367<br />

D.4 Tools . . . . . . . . . . . . . . . . . . . . . . . 368<br />

D.5 Distributions . . . . . . . . . . . . . . . . 368<br />

Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . 369

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!