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


MakeMPX: Support MetaPost labels

In MetaPost, labels can be typeset using any document processor; the Web2c implementation supports TeX and Troff. MakeMPX translates the labels from the typesetting language back into low-level MetaPost commands in a so-called mpx file, so text can be manipulated like other graphic objects. It is invoked automatically by MetaPost. Synopsis:

makempx [-troff] mpfile mpxfile

The input comes from mpfile (no path searching is done), and the output goes to mpxfile. However, if the file mpxfile already exists, and is newer than mpfile, then nothing is done (presumably the file is up-to-date).

Otherwise:

  1. MPto is run to extract the label text from the MetaPost source file mpfile (see section MPto: Extract labels from MetaPost input).
  2. The typesetting program itself is run, either TeX or Troff (see below). If TeX, and the file named by the MPTEXPRE environment variable exists (`mptexpre.tex' by default), that file is prepended to the input from the MetaPost file.
  3. The typesetter output (a DVI file in the case of TeX, Ditroff output for Troff) is translated back to MetaPost, by DVItoMP (see section DVItoMP: DVI to MPX conversion) or DMP (see section DMP: Ditroff to MPX conversion) respectively.

If any of the above steps fail, for example if there was a typesetting mistake in the original mpfile, output may be left in files named `mpxerr.{log,tex,dvi}' (TeX) or `mpxerr{,.t}' (Troff), so you can diagnose the problem.

The `-troff' option to MPto selects the Troff commands, rather than TeX. MetaPost supplies this automatically if the `-T' or `-troff' option was specified to MetaPost.

The MPX file created by MakeMPX is a sequence of MetaPost picture expressions, one for every label in the original MetaPost input file.

The names of the commands run by MakeMPX, and the directory added to the shell search PATH for the commands' location, are overridden by environment variables. Here is a list:

MAKEMPX_BINDIR
The directory added to the PATH. Default is the `$(bindir)' Make directory, which in turn is set from the configure-time `--bindir', `--exec-prefix' and `--prefix' options; if nothing else is specified, the default is file `/usr/local'.
NEWER
The command run to determine if mpxfile is out of date with respect to mpfile; default is `newer'.
MPTOTEX
The command run to extract MetaPost labels in TeX format; default is `mpto -tex'.
MPTOTR
Likewise, for Troff; default is `mpto -troff'.
DVITOMP
The command run to convert TeX output back to MetaPost; default is `dvitomp'.
DMP
Likewise, for Troff; default is `dmp'.
TEX
The command run to typeset the labels in TeX; default is `tex'. If you use LaTeX, set this to latex, and supply an appropriate verbatimtex header in the MP source (see section mpost invocation).
TROFF
Likewise, for Troff; default is `'eqn -d\$\$ | troff -Tpost''. You may need to replace `-Tpost' by `-Tterm', where term is the PostScript device name for your Troff implementation, e.g., `ps' or `psc'; see troff(1). If you change this, you will also need to set the TRFONTS environment variable or configuration value to point to the appropriate font directory, traditionally `/usr/lib/font/devterm'.


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