Index of /systems/unix/tex-gpc/mp
      Name                    Last modified       Size  Description

[DIR] Parent Directory 30-Jun-2014 19:53 - [   ] 25-Aug-2008 02:37 4k [   ] mk_MP_dir 24-Aug-2008 22:09 1k [   ] 26-Aug-2008 04:48 17k [TXT] mptotex.c 05-Jan-1995 03:35 6k [   ] mpx 25-Aug-2008 06:50 1k

Aug. 2008
This is the stage directory to build and install John Hobby's
METAPOST for GPC.  METAPOST produces pictures as PostScript files
that are to be included by dvips in its output.

METAPOST's file formats and their documentation:
.mp	METAPOST source,
	see "A User's manual for MetaPost", AT&T Bell Laboratories
        Computing Science Technical Report 162, 1992
.mpx	METAPOST source, auxiliary file, needed if a .mp file contains text.
.mem	METAPOST format file (
.c	C source (Kernighan/Ritchie The C Programming Language)
.ps	Adobe PostScript 
.<n>    Where n an integer, a PostScript file for picture n, to be included
        by dvips.

builtin file names:
MPlib/mp.pool		string pool for mp, (in inimp)
MPlib/plain.mem  	base file for Plain METAFONT, (in mf)

METAPOST's processors:
          inimp -------> MPlib/plain.mem

.mp, .mpx -------> .n

.mp       -------> .tex

.tex      -------> .dvi

.dvi     --------> .mpx

.mp      --------> .n (combines the last four steps)

Use the shell script mpx instead of mp if your .mp file contains
TeX programs. These extra steps are necessary to include TeX's output
in the picture.

And finally:
.<n>, .dvi, .pk, .tfm ----> PostScript file/printer

Get John Hobby's distribution
The sources from CTAN only work with web2c but not with WEB programs,
so I downloaded the originals from netlib:
unpack it with uncompress and tar xf:
	uncompress metapost.tar.Z
	tar xf metapost.tar
This will give you a directory metapost, from which you copy at least
mp.web,, mptotex.c and dvitomp.web into this directory.

Create the master directories MPlib and MPinputs. Prepare a directory from
where you want to run mp with the shell script mk_MP_dir.
(Additionally to mk_TeX_dir)

Building and installing:
Move a.out into your binary directory under the name at the
right end of --->.

1. mp.web, ---> inimp
Change for initialization (see building inimf, initex) and tgl.
Move mp.pool to MPlib.

2. ---> MPlib/plain.mem
	inimp dump
mv plain.mem to MPlib

3. mp.web, ---> mp
Change for production (see building inimf, initex) and tgl.

4. dvitomp.web, ---> dvitomp
Just tgl and move a.out as dvitomp to your binary directory

5. mptotex.c ---> mptotex
cc mptotex.c, ignore the warning and move a.out to ....

6. mpx ---> mpx (just move the shell script to your binary dir)

Using MetaPost:
To include a MetaPost picture in your output, \input
the TeX macro epsf.tex. At the place where you want to include your
picture, write
where xxx is the name of the picture and n is the argument given
in the beginfig() command.

Here are those files:

a=.7in; b=0.5in;
z0=(0,); z1=(a,0); z2=(0,b);
draw z1..z2..z3..z4..cycle;
drawarrow z0..z1;
drawarrow z0..z2; $a$ etex, .5[z0, z1]);
label.lft(btex $b$ etex, .5[z0, z2]);
end contains two Tex programs, $a$ and $b$. So you need to call mpx instead
of mp. This creates  fig.mpx:

% Written by DVItoMP-GPC
begingroup save _p,_r,_s,_n; picture _p; _p=nullpicture;
string _n[];
vardef _s(expr _t,_f,_m,_x,_y)=
  addto _p also _t infont _f scaled _m shifted (_x,_y); enddef;
setbounds _p to (0,0.0000)--(5.2661,0.0000)--
_p endgroup
begingroup save _p,_r,_s,_n; picture _p; _p=nullpicture;
string _n[];
vardef _s(expr _t,_f,_m,_x,_y)=
  addto _p also _t infont _f scaled _m shifted (_x,_y); enddef;
setbounds _p to (0,0.0000)--(4.2756,0.0000)--
_p endgroup

From and fig.mpx METAPOST creates fig.1

%%BoundingBox: -51 -37 51 37 
%%Creator: MetaPost
%%CreationDate: 2008.08.25:1829
%%Pages: 1
%*Font: cmmi10 9.96265 9.96265 61:c
%%Page: 1 1
 0 0.5 dtransform truncate idtransform setlinewidth pop [] 0 setdash
 1 setlinejoin 10 setmiterlimit
newpath 50.39978 0 moveto
50.39978 23.04858 25.56044 36 0 36 curveto
-25.56044 36 -50.39978 23.04858 -50.39978 0 curveto
-50.39978 -23.04858 -25.56044 -36 0 -36 curveto
25.56044 -36 50.39978 -23.04858 50.39978 0 curveto closepath stroke
 1 setlinecap
newpath 0 0 moveto
50.39978 0 lineto stroke
newpath 46.70451 -1.53067 moveto
50.39978 0 lineto
46.70451 1.53067 lineto
gsave fill grestore stroke
 0.5 0 dtransform exch truncate exch idtransform pop setlinewidth
newpath 0 0 moveto
0 36 lineto stroke
 0 0.5 dtransform truncate idtransform setlinewidth pop
newpath 1.5308 32.3044 moveto
0 36 lineto
-1.5308 32.3044 lineto
gsave fill grestore stroke
22.56683 3 moveto
(a) cmmi10 9.96265 fshow
-7.2756 14.54074 moveto
(b) cmmi10 9.96265 fshow

Finally, include the figure in your TeX document by
\input epsf