\startcomponent ma-cb-en-metapost

\enablemode[**en-us]

\project ma-cb

\startchapter[title=Graphical extension / \METAPOST]

\index[metapost]{\METAPOST}
\index{graphical features}

The graphical possibilities of \TEX||related macro packages are rather limited.
However, by using the graphical package \METAPOST\ of John Hobby a complete range
of graphical features has become available that may improve the look of your
documents.

In \CONTEXT\ there is a direct link to \METAPOST\ so users can apply the features
of \METAPOST\ directly into their documents. The chapter headers and page numbers
of this manual are extended by some graphical elements that are generated by
\METAPOST.

If you look carefully at these \METAPOST\ extensions you will notice a lot of
contextual adaptation (width and height dependend) and randomization. So you can do
things in your document that are not possible in other typesetting applications.

A more practical example (for a mathematician at least) is drawn in \in {figure}
[fig:metapostexample]:

\startbuffer
\startreusableMPgraphic{origin}
  path pb; pb:=(5.5cm,0cm)..(10.5cm,0cm);
  path qb; qb:=(8cm,-1cm)..(8cm,2.5cm);
  pickup pencircle scaled 0.5mm;
  drawarrow pb;
  drawarrow qb;
  draw thelabel.rt(btex $x$ etex,(10.6cm,0cm));
  draw thelabel.top(btex $y$ etex,(8cm,2.6cm));
  path l; l:=(5.5cm,-0.5cm)..(10.5cm,2cm);
  pickup pencircle scaled 0.3mm;
  draw l withcolor blue ;
  pair A; A:=(6cm,-0.25cm);
  pair B; B:=(9.3cm,1.4cm);
  pair C; C:=(9.3cm,-0.25cm);
  pickup pencircle scaled 0.15cm;
  drawdot A; drawdot B; drawdot C;
  draw thelabel.lrt(btex $\scriptstyle P_1(x_1,y_1)$ etex ,A);
  draw thelabel.lrt(btex $\scriptstyle P_2(x_2,y_2)$ etex ,B);
  draw thelabel.bot(btex $\scriptstyle P(x_2,y_1)$ etex ,C);
  path s; s:=A..(9.3cm,-0.25cm);
  draw s dashed (evenly scaled 1mm) withpen pencircle scaled 0.3mm;
  path t; t:=B..(9.3cm,-0.25cm);
  draw t dashed (evenly scaled 1mm) withpen pencircle scaled 0.3mm;
\stopreusableMPgraphic
\stopbuffer

\getbuffer

\placefigure
  [here]
  [fig:metapostexample]
  {\METAPOST\ example.}
  {\reuseMPgraphic{origin}}

This example is taken from the mathematical text book {\em Algetrigulus} by
Philip Brown. All graphics in his book are made by means of \METAPOST. This
one is defined by:

\typebuffer

The usage and features of \METAPOST\ within \CONTEXT\ are described in the
extensive \goto {\METAFUN\ manual} [ url (manual:metafun) ].

\stopchapter

\stopcomponent
