MetaPost | |
Paradigm: | imperative, typesetting |
Designer: | John D. Hobby |
Developer: | Taco Hoekwater, Luigi Scarso |
Latest Release Version: | 1.8 |
Latest Preview Version: | 2.0rc2 |
Typing: | duck, dynamic, strong |
Influenced By: | Metafont |
Operating System: | Cross-platform |
License: | LGPL |
MetaPost refers to both a programming language and the interpreter of the MetaPost programming language. Both are derived from Donald Knuth's Metafont language and interpreter. MetaPost produces vector graphic diagrams from a geometric/algebraic description. The language shares Metafont's declarative syntax for manipulating lines, curves, points and geometric transformations. However,
Many of the limitations of MetaPost derive from features of Metafont. For instance, MetaPost does not support all features of PostScript. Most notably, paths can have only one segment (so that regions are simply connected), and regions can be filled only with uniform colours. PostScript level 1 supports tiled patterns and PostScript 3 supports Gouraud shading.
MetaPost is distributed with many distributions of the TeX and Metafont framework, for example, it is included in the MiKTeX and the TeX Live distributions.
The encapsulated postscript produced by Metapost can be included in LaTeX, ConTeXt, and TeX documents via standard graphics inclusion commands. The encapsulated postscript output can also be used with the PDFTeX engine, thus directly giving PDF. This ability is implemented in ConTeXt and in the LaTeX graphics package, and can be used from plain TeX via the supp-pdf.tex macro file.
ConTeXt and LuaTeX supports the inclusion of MetaPost code within the input file. Inclusion of MetaPost code in LaTeX is also possible by using LaTeX-packages, for example gmp
or mpgraphics
.
This is a single file example.mp which when processed by the MetaPost interpreter (via the command mpost
on Linux) produces three eps files example.1, example.2, example.3. These are pictured on the right.
The resulting three eps files can be used in TeX via LaTeX's \includegraphics
command, ConTeXt's \externalfigure
, Plain TeX's \epsfbox
command, or (in Plain pdftex) the \convertMPtoPDF
command from supp-pdf.tex. To view or print the third diagram, this inclusion is necessary, as the TeX fonts (Computer Modern) are not included in the eps files produced by MetaPost by default.