MetaPost

Command name

mpost - MetaPost, a system for drawing pictures

Usual usage

mpost [filename]

Description

MetaPost interprets the MetaPost language and produces PostScript pictures. The MetaPost language is similar to Knuth's Metafont with additional features for including TeX commands and accessing features of PostScript not found in Metafont.

Like TeX and Metafont, MetaPost is normally used with a large body of precompiled macros.

An argument given on the command line behaves as the first input line. That can be either a (possibly truncated) file name or a sequence MetaPost commands starting with \ and including an input command. Thus

mpost figs
processes the file figs.mp. The basename of figs becomes the ``jobname'', and is used in forming output file names. If no file is named, the jobname becomes mpout. The default extension, .mp, can be overridden by specifying an extension explicitly.

There is normally one output file for each picture generated, and the output files are named jobname.nnn, where nnn is a number passed to the beginfig macro. The output file name can also be jobname.ps if this number is negative.

The output files can be used as figures in a LaTeX document by using package graphicx and then using the macro

\includegraphics*[height=H, width=W]{ jobname.nnn}
to produce a box of the appropriate size H x W containing the figure.

The output files can be used as figures in a TeX document by including

\special{psfile=jobname.nnn}
in the TeX document. Alternatively, one can \input epsf.tex and then use the macro
\epsfbox{jobname.nnn}
to produce a box of the appropriate size containing the figure.

Some of the MetaPost language

btex TeX commands etex
This causes mpost to generate a MetaPost picture expression that corresponds to the TeX commands. If the TeX commands generate more than one line of text, it must be in a \vbox or a minipage environment.
verbatimtex TeX commands etex
This is ignored by mpost except that the TeX commands are passed on to TeX. When using LaTeX instead of TeX the input file must start with a verbatimtex block that gives the \documentclass and \begin{document} commands.

Recommendations

See also ...