% output=pdftex engine=pdftex language=uk
%
% copyright=pragma-ade readme=readme.pdf licence=cc-by-nc-sa

\startcomponent mfun-001

\environment mfun-000

\title {Introduction}

This document is about \METAPOST\ and \TEX. The former is a
graphic programming language, the latter a typographic
programming language. However, in this document we will not
focus on real programming, but more on how we can interface
between those two languages. We will do so by using
\CONTEXT, a macro package written in \TEX, in which support
for \METAPOST\ is integrated in the core. The \TEX\ macros
are integrated in \CONTEXT, and the \METAPOST\ macros are
bundled in \METAFUN.

When Donald Knuth wrote his typographical programming
language \TEX\ he was in need for fonts, especially
mathematical fonts. So, as a side track, he started writing
\METAFONT, a graphical language. When you read between the
lines in the \METAFONT\ book and the source code, the name
John Hobby is mentioned alongside complicated formulas. It
will be no surprise then, that, since he was tightly
involved in the development of \METAFONT, after a few years
his \METAPOST\ showed up.

While its ancestor \METAFONT\ was originally targeted at
designing fonts, \METAPOST\ is more oriented to drawing
graphics as used in scientific publications. Since
\METAFONT\ produced bitmap output, some of its operators
make use of this fact. \METAPOST\ on the other hand produces
\POSTSCRIPT\ code, which means that it has some features not
present in \METAFONT\ and vise versa.

With \METAFUN\ I will demonstrate that \METAPOST\ can also
be used, or misused, for less technical drawing purposes. We
will see that \METAPOST\ can fill in some gaps in \TEX,
especially its lack of graphic capabilities. We will
demonstrate that graphics can make a document more
attractive, even if it is processed in a batch processing
system like \TEX. Most of all, we will see that embedding
\METAPOST\ definitions in the \TEX\ source enables a smooth
communication between both programs.

The best starting point for using \METAPOST\ is the manual
written by its author John Hobby. You can find this manual
at every main \TEX\ repository. Also, a copy of the
\METAFONT\ book from Donald Knuth is worth every penny, if
only because it will give you the feeling that many years of
graphical fun lays ahead.

In this \METAFUN\ manual we will demonstrate how you can
embed graphics in a \TEX\ document, but we will also
introduce most of the features of \METAPOST. For this reason
you will see a lot of \METAPOST\ code. For sure there are
better methods to solve problems, but I have tried to
demonstrate different methods and techniques as much as
possible.

I started using \METAPOST\ long after I started using \TEX,
and I never regret it. Although I like \TEX\ very much, I
must admit that sometimes using \METAPOST\ is even more fun.
Therefore, before we start exploring both in depth, I want
to thank their creators, Donald Knuth and John Hobby, for
providing me these fabulous tools. Of course I also need to
thank \THANH, for giving the \TEX\ community \PDFTEX, as
well as providing me the hooks I considered neccessary for
implementing some of the features presented here.

I also want to thank David Arnold and Ton Otten for their
fast proofreading, for providing me useful input, and for
testing the examples. Without David's patience and help, this
document would be far from perfect English and less complete.
Without Ton's help, many small typos would have gone
unnoticed.

\blank

Hans Hagen, \currentdate

\stopcomponent
