Go to the first, previous, next, last section, table of contents.


mpost invocation

MetaPost (installed as mpost) reads a series of pictures specified in the MetaPost programming language, and outputs corresponding PostScript code. This section merely describes the options available in the Web2c implementation. For a complete description of the MetaPost language, see AT&T technical report CSTR-162, generally available as the file `texmf/doc/metapost/mpman.ps', where texmf is the root of TeX directory structure. See also `http://cm.bell-labs.com/who/hobby/MetaPost.html'.

Also, a standard MetaPost package for drawing graphs is documented in AT&T technical report CSTR-164, available as the file `mpgraph.ps', generally stored alongside `mpman.ps'.

MetaPost processes its command line and determines its memory dump (mem) file in a way exactly analogous to Metafont and TeX (see section tex invocation, and see section Memory dumps). Synopses:

mpost [option]... [mpname[.mp]] [mp-commands]
mpost [option]... \first-line
mpost [option]... &mem args

MetaPost searches the usual places for the main input file mpname (see section `Supported file formats' in Kpathsea), extending mpname with `.mp' if necessary. To see all the relevant paths, set the environment variable KPATHSEA_DEBUG to `-1' before running the program.

MetaPost writes its PostScript output to a series of files `basempname.nnn' (or perhaps `basempname.ps', very occasionally `basempname.tfm'), where nnn are the figure numbers specified in the input, typically to the beginfig macro, and basempname is the basename of mpname, or `mpout' if no input file was specified. MetaPost uses the `.ps' extension when the figure number is out of range, e.g., if you say beginfig(-1).

You can use the output files as figures in a TeX document just as with any other PostScript figures. For example, with this TeX command:

\special{psfile="filename"}

or by using `epsf.tex' (see section `EPSF macros' in Dvips).

The MetaPost construct

btex ... tex-input ... etex

calls MakeMPX to generate a MPX file containing a MetaPost picture expression corresponding to tex-input (see section MakeMPX: Support MetaPost labels).

The construct

verbatimtex ... tex-input ... etex

simply passes the tex-input through to MakeMPX and thus to TeX. For example, if you are using LaTeX, your MetaPost input file must start with a verbatimtex block that gives the necessary \documentclass (or \documentstyle) \begin{document} command. You will also need to set the enviroment variable TEX to `latex' (see section MakeMPX: Support MetaPost labels).

tex-input need not be specifically TeX input; it could also be Troff. In that case, you will need the `-m pictures' Troff macro package (unfortunately absent from many Troff implementations), or an equivalent such as the `-m pspic' macros from GNU groff described in grops(1).

Other typesetters can be supported with no change to MetaPost itself; only MakeMPX needs to be updated.

Naturally, you must use fonts that are supported by the typesetter; specifically, you'll probably want to use standard PostScript fonts with Troff. And only the TeX system understands Computer Modern or other Metafont fonts; you can also use PostScript fonts with TeX, of course.

MetaPost-generated PostScript figures which do use Computer Modern fonts for labels cannot be directly previewed or printed. Instead, you must include them in a TeX document and run the resulting DVI file through Dvips to arrange for the downloading of the required fonts (see section `Fonts in figures' in Dvips). To help with this, the MetaPost distribution provides a small TeX file `mproof.tex' which is typically called as:

tex mproof mp-output-files... ; dvips mproof -o

The resulting file `mproof.ps' can then be printed or previewed.

To generate EPSF files, set the internal MetaPost variable prologues positive. To make the output files self-contained, use only standard PostScript fonts. MetaPost reads the same `psfonts.map' file as Dvips, to determine PostScript fonts that need to be downloaded (see section `psfonts.map' in Dvips).

MetaPost can write output files, via the write primitive; this opens a security hole. See section tex invocation.

The program accepts the following options, as well as the standard `-help' and `-version' (see section Common options):

`-kpathsea-debug=number'
`-ini'
`-mem=memname'
`-progname=string'
These options are common to TeX, Metafont, and MetaPost. See section Common options.
`-T'
`-troff'
Set the prologues internal variable to 1, and use makempx -troff to generate MPX files.


Go to the first, previous, next, last section, table of contents.