next up previous contents index
Next: Mgr Up: Mf Previous: Mf   Contents   Index


METAFONT Instructions

- Set your terminal to METAFONT:

 set terminal mf

- Select an output-file, e.g.:
 set output "myfigures.mf"

- Create your pictures. Each picture will generate a separate character. Its default size will be 5*3 inches. You can change the size by saying set size 0.5,0.5 or whatever fraction of the default size you want to have.

- Quit gnuplot.

- Generate a TFM and GF file by running METAFONT on the output of gnuplot. Since the picture is quite large (5*3 in), you will have to use a version of METAFONT that has a value of at least 150000 for memmax. On Unix systems these are conventionally installed under the name bigmf. For the following assume that the command virmf stands for a big version of METAFONT. For example:

- Invoke METAFONT:

   virmf '&plain'

- Select the output device: At the METAFONT prompt ('*') type:
   \mode:=CanonCX;     % or whatever printer you use

- Optionally select a magnification:
   mag:=1;             % or whatever you wish

- Input the gnuplot-file:
   input myfigures.mf

On a typical Unix machine there will usually be a script called "mf" that executes virmf '&plain', so you probably can substitute mf for virmf &plain. This will generate two files: mfput.tfm and mfput.$$$gf (where $$$ indicates the resolution of your device). The above can be conveniently achieved by typing everything on the command line, e.g.: virmf '&plain' '3#3mode:=CanonCX; mag:=1; input myfigures.mf' In this case the output files will be named myfigures.tfm and myfigures.300gf.

- Generate a PK file from the GF file using gftopk:

 gftopk myfigures.300gf myfigures.300pk

The name of the output file for gftopk depends on the DVI driver you use. Ask your local TeX administrator about the naming conventions. Next, either install the TFM and PK files in the appropriate directories, or set your environment variables properly. Usually this involves setting TEXFONTS to include the current directory and doing the same thing for the environment variable that your DVI driver uses (no standard name here...). This step is necessary so that TeX will find the font metric file and your DVI driver will find the PK file.

- To include your pictures in your document you have to tell TeX the font:

 \font\gnufigs=myfigures

Each picture you made is stored in a single character. The first picture is character 0, the second is character 1, and so on... After doing the above step, you can use the pictures just like any other characters. Therefore, to place pictures 1 and 2 centered in your document, all you have to do is:
 \centerline{\gnufigs\char0}
 \centerline{\gnufigs\char1}

in plain TeX. For LaTeX you can, of course, use the picture environment and place the picture wherever you wish by using the 3#3makebox and 3#3put macros.

This conversion saves you a lot of time once you have generated the font; TeX handles the pictures as characters and uses minimal time to place them, and the documents you make change more often than the pictures do. It also saves a lot of TeX memory. One last advantage of using the METAFONT driver is that the DVI file really remains device independent, because no 3#3special commands are used as in the eepic and tpic drivers.


next up previous contents index
Next: Mgr Up: Mf Previous: Mf   Contents   Index
Ethan Merritt 2007-03-03