MetaPost is a graphical programming language, based on Donald Knuth's MetaFont. Normally MP graphics are converted to PostScript and used with dvips, but ConTeXt can use it directly with PDF (see the MP to PDF manual).
MetaPost is ConTeXt's native graphics language. MetaFun is a MetaPost module by Hans Hagen that adds a lot of extra features; it is enabled by default, so one could say that MetaFun is ConTeXt's default dialect of MetaPost.
Documentation & Tutorials
- A User's Manual for MetaPost
- Learning METAPOST by doing (this and this link are not working)
- A Beginner's Guide to METAPOST for Creating High-Quality Graphics by Troy Henderson
- MetaFun
- Lots of examples
- Color in MetaPost describes how to get color mixtures, TeX colors, and transparent effects in MetaPost graphics.
Using MetaPost in ConTeXt
With \startuseMPgraphic, you define a piece of graphics code that is processed anew every time the graphic is placed with \useMPgraphic. Further commands are described at MetaPost in ConTeXt.
\def\mycolor{.625red} \startuseMPgraphic{name} fill fullcircle scaled 20pt withcolor \mycolor; \stopuseMPgraphic red: \useMPgraphic{name} \def\mycolor{.625blue} blue: \useMPgraphic{name}
Different Packages, Extensions & Applications of Metapost
- MetaPlot - graph drawing
- MetaObj - object-oriented drawing, see also the page about MetaObj and Labels
- finomaton - drawing finite state automata
- statsmac - metapost macros for statistics graphs
- MetaUML - MetaPost library for typesetting UML diagrams
- METAGRAPH - drawing (un)directed graphs
3D support
|
TODO: needs major review (See: To-Do List) |
MetaPost relatives
Font Creation
3D drawing
- Asymptote - inspired by MetaPost & fully generalizes MetaPost path construction algorithms to three-dimensions
Testing plain MetaPost
To test whether MetaPost is installed on your system, create a file called test.mp
:
beginfig(1) draw fullcircle scaled 3cm ; endfig ; end ;
- apply MetaPost on the testfile
mp test.mp or mpost test.mp
- that should create a postscript file test.1
- open test.1 with a postscript viewer like Ghostview, Okular, … You should see a circle.
Testing MetaPost embedded in ConTeXt
If MetaPost is installed on your system and working correctly, you can
\starttext \startMPcode draw fullcircle scaled 3cm; \stopMPcode \stoptext
- for mkii you need to have write18 support enabled and run
texexec --pdf test.tex
- for mkiv run
context test.tex
- that should create a pdf file test.pdf
- open test.pdf with a pdf viewer like Adobe Acrobat, Okular... You should see a circle.
Other Links
- Metapost home page: http://tug.org/metapost
- John Hobby's page: http://cm.bell-labs.com/who/hobby/MetaPost.html
- Current development: http://foundry.supelec.fr/projects/metapost/
- http://melusine.eu.org/syracuse/metapost/