%%%
%%%  File:  setups.tex
%%%

% abbreviations
\def\LaTeX{{\rm L\raise.42ex\hbox{\kern-.3em a}\kern-.15em\TeX}}
\def\PiCTeX{{\rm P\kern-.12em\lower.5ex\hbox{I}\kern-.075emC\kern-.11em\TeX}}
\font\manual=logo10 % may want to use manfnt here instead
\def\MF{{\manual META}\-{\manual FONT}}
\def\PS{{\rm Post}\-{\rm Script}}


\noindent{\it Setting up on {\tt UNIX}.} 

This document explains how to set up {\tt mfpic} on one specific
configuration of
machine -- a {\tt UNIX} machine running {\tt csh} and X Windows, with a \PS\
compatible printer.  In particular, this document explains how to set
up the {\tt UNIX}
environment variables for \TeX, \MF, {\tt dvips}, and {\tt 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 {\tt pictures.tex}. 
\TeX\ generates a
Metafont file {\tt pics.mf}.  Then processing {\tt pics.mf} with \MF\ 
(using the {\tt UNIX} command ``{\tt mf '\string\mode=localfont; input
pics'}") 
generates  the files
{\tt pics.tfm} and {\tt pics.360gf} (since {\tt pictures.tex} includes
the command 
{\tt \string\magnification=\string\magstep1}).  However, when you run
\TeX\ again on 
{\tt pictures.tex}, \TeX\ still can't find the file {\tt pics.tfm}. 
This is because
the system default for the {\tt UNIX} path environment variable {\tt
TEXFONTS} doesn't
include the current directory.  This is, in fact, the problem with most of the
relevant environment variables -- \TeX\ can't find {\tt pics.tfm}
because of the 
{\tt TEXFONTS} environment variable, {\tt xdvi} can't find {\tt
pics.360gf} because of
the {\tt XDVIFONTS} environment variable, etc.  All of the relevant
variables can be
set up properly by installing the {\tt mfpicsetup} script below and
then typing 
``{\tt source mfpicsetup}" at the command prompt (or including this
command in your
{\tt .cshrc} file).

There is a more serious problem, though.  The printing command ``{\tt
lpr -d}" 
(``{\tt -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 \PS\
format using {\tt dvips}, then print the \PS\ file.  But {\tt dvips}
uses fonts in PK
(packed pixel) format, not the GF (generic font) format that \MF\
generates.  So you
need to run {\tt gftopk} in the file {\tt pics.360gf}.  There are
scripts included
below to make all of these processes easier.

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

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

\noindent
The next script allows you to process a \TeX\ file containing {\tt 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 \MF) -- with the 
``{\tt -n}" option (mnemonic for ``new file"), it will also include the
third step,
reprocessing with \TeX.  You must include {\it both} the name of the
\TeX\ file and
the name of the \MF\ file it generates.    You should save this
script as ``{\tt domfpic}" -- then, for example, the command 

\par{\tt domfpic -n pictures pics}

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

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

\noindent 
The next script does the printing -- so it includes the {\tt gftopk} and
{\tt dvips} steps, along with an {\tt lpr} command.  Again, you must include 
{\it both} the name of the \TeX\ file and the name of the \MF\ file it
generates --
but this time you absolutely {\it cannot} include the subscripts {\tt
.tex} and 
{\tt mf}.   This script also cleans up after itself by removing the PK
and \PS\ files 
when it is done.  You should save this script as ``{\tt prmfpic}".

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

\end
