Setting up on UNIX.

This document explains how to set up mfpic on one specific configuration of machine – a UNIX machine running csh and X Windows, with a PostScript compatible printer. In particular, this document explains how to set up the UNIX environment variables for TEX, , dvips, and xdvi (which is a DVI viewer for X Windows). Many of these procedures will be necessary, in some form or another, on most machines.

Look at the case of processing the sample file pictures.tex. TEX generates a Metafont file pics.mf.

Then processing pics.mf with  (using the UNIX command “mf '\mode=localfont; input pics'”)

generates the files pics.tfm and pics.360gf (since pictures.tex includes the command \magnification=\magstep1). However, when you run TEX again on pictures.tex, TEX still can’t find the file pics.tfm. This is because the system default for the UNIX path environment variable TEXFONTS doesn’t include the current directory. This is, in fact, the problem with most of the relevant environment variables – TEX can’t find pics.tfm because of the TEXFONTS environment variable, xdvi can’t find pics.360gf because of the XDVIFONTS environment variable, etc. All of the relevant variables can be set up properly by installing the mfpicsetup script below and then typing “source mfpicsetup” at the command prompt (or including this command in your .cshrc file).

There is a more serious problem, though. The printing command “lpr -d” (“-d” is the DVI printing option) will not find local fonts, and there is no environment variable you can change to make it find them. The best thing to do in this case is to convert your DVI file to PostScript format using dvips, then print the PostScript file. But dvips uses fonts in PK (packed pixel) format, not the GF (generic font) format that generates. So you need to run gftopk in the file pics.360gf. There are scripts included below to make all of these processes easier.

The scripts included here are all csh scripts. You should save them in one of the directories that your PATH environment variable points to. The first script sets up the environment variables so that TEX, xdvi, and dvips can all find the fonts generated by in the current directory. You should save this script as “mfpicsetup”, then include the line “source mfpicsetup” in your .cshrc file. The last line of this script makes sure that xdvi looks for the font in the appropriate resolution.

    #!/bin/csh
    set A=$TEXFONTS
    setenv TEXFONTS .:$A
    set A=$TEXPKS
    setenv TEXPKS .:$A
    set A=$XDVIFONTS
    setenv XDVIFONTS .:$A
    alias xdvi 'xdvi -p 300 -s 3'

The next script allows you to process a TEX file containing mfpic commands and generate the fonts all in one step. It will automatically go through the first two steps (processing with TEX and processing with - ) – with the “-n” option (mnemonic for “new file”), it will also include the third step, reprocessing with TEX. You must include both the name of the TEX file and the name of the file it generates. You should save this script as “domfpic” – then, for example, the command

    domfpic -n pictures pics

will go through all three steps for pictures.tex, generating the files pictures.dvi, pics.mf, pics.tfm, and pics.360gf. This will allow you to view pictures.dvi with xdvi.

    #!/bin/csh
    set OPT=-n
    if ($1 == $OPT) then
    tex $2
    mf '\mode=localfont;' input $3
    tex $2
    else
    tex $1
    mf '\mode=localfont;' input $2
    endif

The next script does the printing – so it includes the gftopk and dvips steps, along with an lpr command. Again, you must include both the name of the TEX file and the name of the file it generates – but this time you absolutely cannot include the subscripts .tex and mf. This script also cleans up after itself by removing the PK and PostScript files when it is done. You should save this script as “prmfpic”.

#!/bin/csh
foreach B ($2.*gf)
gftopk -v $B
end
dvips -Z $1.dvi
lpr $1.ps
rm $2.*pk
rm $1.ps