ma-cb-en-metapost.tex /size: 2468 b    last modification: 2020-07-01 14:35
1\startcomponent ma-cb-en-metapost
2
3\enablemode[**en-us]
4
5\project ma-cb
6
7\startchapter[title=Graphical extension / \METAPOST]
8
9\index[metapost]{\METAPOST}
10\index{graphical features}
11
12The graphical possibilities of \TEX||related macro packages are rather limited.
13However, by using the graphical package \METAPOST\ of John Hobby a complete range
14of graphical features has become available that may improve the look of your
15documents.
16
17In \CONTEXT\ there is a direct link to \METAPOST\ so users can apply the features
18of \METAPOST\ directly into their documents. The chapter headers and page numbers
19of this manual are extended by some graphical elements that are generated by
20\METAPOST.
21
22If you look carefully at these \METAPOST\ extensions you will notice a lot of
23contextual adaptation (width and height dependend) and randomization. So you can do
24things in your document that are not possible in other typesetting applications.
25
26A more practical example (for a mathematician at least) is drawn in \in {figure}
27[fig:metapostexample]:
28
29\startbuffer
30\startreusableMPgraphic{origin}
31  path pb; pb:=(5.5cm,0cm)..(10.5cm,0cm);
32  path qb; qb:=(8cm,-1cm)..(8cm,2.5cm);
33  pickup pencircle scaled 0.5mm;
34  drawarrow pb;
35  drawarrow qb;
36  draw thelabel.rt(btex $x$ etex,(10.6cm,0cm));
37  draw thelabel.top(btex $y$ etex,(8cm,2.6cm));
38  path l; l:=(5.5cm,-0.5cm)..(10.5cm,2cm);
39  pickup pencircle scaled 0.3mm;
40  draw l withcolor blue ;
41  pair A; A:=(6cm,-0.25cm);
42  pair B; B:=(9.3cm,1.4cm);
43  pair C; C:=(9.3cm,-0.25cm);
44  pickup pencircle scaled 0.15cm;
45  drawdot A; drawdot B; drawdot C;
46  draw thelabel.lrt(btex $\scriptstyle P_1(x_1,y_1)$ etex ,A);
47  draw thelabel.lrt(btex $\scriptstyle P_2(x_2,y_2)$ etex ,B);
48  draw thelabel.bot(btex $\scriptstyle P(x_2,y_1)$ etex ,C);
49  path s; s:=A..(9.3cm,-0.25cm);
50  draw s dashed (evenly scaled 1mm) withpen pencircle scaled 0.3mm;
51  path t; t:=B..(9.3cm,-0.25cm);
52  draw t dashed (evenly scaled 1mm) withpen pencircle scaled 0.3mm;
53\stopreusableMPgraphic
54\stopbuffer
55
56\getbuffer
57
58\placefigure
59  [here]
60  [fig:metapostexample]
61  {\METAPOST\ example.}
62  {\reuseMPgraphic{origin}}
63
64This example is taken from the mathematical text book {\em Algetrigulus} by
65Philip Brown. All graphics in his book are made by means of \METAPOST. This
66one is defined by:
67
68\typebuffer
69
70The usage and features of \METAPOST\ within \CONTEXT\ are described in the
71extensive \goto {\METAFUN\ manual} [ url (manual:metafun) ].
72
73\stopchapter
74
75\stopcomponent
76