Article View: comp.text.tex
Article #2394mfpic -- setting up
From: Thomas Leathrum
Date: Wed, 09 Sep 1992 03:08
Date: Wed, 09 Sep 1992 03:08
392 lines
13181 bytes
13181 bytes
This posting inlcudes below a shell archive containing 4 files:
setups.tex, which
describes how to set up and process TeX files containing mfpic commands, with
shortcuts provided by C-shell scripts; Makefile, which provides other
shortcuts,
using make instead of C-shell; README, which describes what the Makefile
does; and
mfmake, which is a C-shell script prividing one quick shortcut with the
Makefile.
Thanks to Geoffrey Tobin for the Makefile and its documentation. The
setups.tex file
was written by me, so I take all blame for that.
In general, the biggest problem any user of mfpic is likely to have getting the
installation set up to handle mfpic will come from convincing TeX and
its output
drivers to find the Metafont output files, which will wind up in your current
directory. More often that not, on UNIX at least, this can be accomplished by
appending ".:" to the beginning of a few environment variables. This
will not solve
all problems, though -- for example, print spooling with a DVI filter
option with
"lpr -d" absolutely cannot be convinced to look in the current directory
for a font.
So you have to convert the DVI to some other format before printing, and
convince the
conversion program to find the font.
The C-shell scripts in the file setups.tex assume a UNIX installation running X
Windows, so that in particular you can use xdvi, dvips, and a few other
UNIX programs.
The Makefile works with slightly different assumptions, but is still
UNIX-specific.
The procedures these describe will probably be similar on many other sorts of
machines, but I'm not likely to know the specifics.
Once you are over the hurdle of setting up, though, I hope you enjoy
mfpic. Let me
know what you think, if you can find any bugs, etc.
Regards,
Tom Leathrum
moth@dartmouth.edu
-----------
#!/bin/sh
# This is a shell archive (shar 3.20)
# made 09/08/1992 03:26 UTC by leathrum@griggs
# Source directory
/a/quimby/usr/toe/misc/leathrum/TeXstuff/mfpic.dir/Misc/directory
#
# existing files WILL be overwritten
#
# This shar contains:
# length mode name
# ------ ---------- ------------------------------------------
# 3013 -r--r--r-- Makefile
# 324 -r--r--r-- README
# 21 -r-xr--r-- mfmake
# 5043 -rwxr-xr-x setups.tex
#
if touch 2>&1 | fgrep '[-amc]' > /dev/null
then TOUCH=touch
else TOUCH=true
fi
# ============= Makefile ==============
echo "x - extracting Makefile (Text)"
sed 's/^X//' << 'SHAR_EOF' > Makefile &&
X# Makefile for mfpic - 07:13 GMT Fri 4 Sep 1992 - Geoffrey Tobin.
X# For mfpic version 0.1.12.5 of Thu 3 Sep 92.
X#
X# The targets are: manifest, dvi, ps, zip, unzip, cat, shar, unshar,
X# and clean.
X
XSRCS = mfmake Makefile README graphbase.mf lamfpic.tex lapictures.tex \
X mfpic.tex mfpicdoc.tex objects.tex pictures.tex setups.tex
X
XSRC1 = MANIFEST $(SRCS)
X
XOUTPUT = *.dvi *log *.aux *.tfm *.*gf *.*pk *.ps pics.mf objs.mf
X
X# DVI -> PostScript converter.
X# This is merely where I keep my favorite, Tom Rokicki's dvips.
X# Available at labrea.stanford.edu, in directory ./pub.
X
XDVIPS=/usr1/TeX/TeX3.14/bin/dvips -Z
X
X# ZIP and UNZIP programs.
X# These also are particular favorites, copied into my bin directory.
X
XZIP=$(HOME)/bin/zip
XUNZIP=$(HOME)/bin/unzip
X
Xmanifest: $(SRCS)
X ls -l $(SRCS) > MANIFEST
X
X# DVI files.
X# Make DVI files by default, because they are useful for all output
X# drivers.
X
Xdvi: setups.dvi mfpicdoc.dvi pictures lapictures objects
X
X# Instructions for Setting up for Installation.
X
Xsetups.dvi: setups.tex
X tex setups
X
X# User Documentation.
X
Xmfpicdoc.dvi: mfpicdoc.tex
X tex mfpicdoc
X
X# TeX test of mfpic.
X
Xpictures: pictures.tex mfpic.tex graphbase.mf
X tex pictures
X mf '\mode=localfont; mag=magstep(1); input ./pics'
X gftopk pics.360gf
X rm pics.360gf
X tex pictures
X mkdir plainpics
X cp pics.tfm plainpics
X cp pics.*pk plainpics
X
X# LaTeX test of mfpic.
X
Xlapictures: lapictures.tex lamfpic.tex mfpic.tex graphbase.mf
X latex lapictures
X mf '\mode=localfont; mag=magstep(0); input ./pics'
X gftopk pics.300gf
X rm pics.300gf
X latex lapictures
X mkdir latexpics
X cp pics.tfm latexpics
X cp pics.*pk latexpics
X
X# TeX test of a variety of mfpic objects.
X
Xobjects: objects.tex mfpic.tex graphbase.mf
X tex objects
X mf '\mode=localfont; mag=magstep(0); input ./objs'
X gftopk objs.360gf
X rm objs.360gf
X tex objects
X
X# PostScript files.
X# PostScript previewers and printers are common, but not universal.
X
Xps: setups.ps mfpicdoc.ps pictures.ps lapictures.ps objects.ps
X
Xsetups.ps: setups.dvi
X $(DVIPS) setups -o setups.ps
X
Xmfpicdoc.ps: mfpicdoc.dvi
X $(DVIPS) mfpicdoc -o mfpicdoc.ps
X
Xpictures.ps: pictures.dvi pics.360pk
X $(DVIPS) pictures -o pictures.ps
X
Xlapictures.ps: lapictures.dvi pics.300pk
X $(DVIPS) lapictures -o lapictures.ps
X
Xobjects.ps: objects.dvi objs.360pk
X $(DVIPS) objects -o objects.ps
X
X# Zip file.
X# Portable zip and unzip are free; Valeria in California is one site
X# that has them. See the comp.misc "archives" posting for sites.
X
Xzip: $(SRC1)
X $(ZIP) mfpic.zip $(SRC1)
X
Xunzip: mfpic.zip
X $(UNZIP) mfpic
X
Xcat: $(SRC1)
X cat $(SRC1) > mfpic.cat
X
X# shar is available for both unix and DOS.
X
Xshar: $(SRC1)
X shar $(SRC1) > mfpic.shar
X
X# Unshar using Bourne shell, of which there are versions for DOS!
X# Or to use "unshar", which is also available for DOS from Simtel-20,
X# comment the "sh" lines with "#", and uncomment the "unshar" lines.
X
Xunshar: mfpic.shar
X sh mfpic.shar
X
X# unshar: $(SRCS)
X# sh mfpic.shar
X
Xclean: $(OUTPUT)
X rm $(OUTPUT)
SHAR_EOF
$TOUCH -am 0907232492 Makefile &&
chmod 0444 Makefile ||
echo "restore of Makefile failed"
set `wc -c Makefile`;Wc_c=$1
if test "$Wc_c" != "3013"; then
echo original size 3013, current size $Wc_c
fi
# ============= README ==============
echo "x - extracting README (Text)"
sed 's/^X//' << 'SHAR_EOF' > README &&
XREADME for mfpic - version 1 - 18:20 Fri 21 Aug 1992 - Geoffrey Tobin.
X
XUnder unix, because "tex" returns an error after finding no TFM file
Xfor the graphics on the first pass, and because this normally causes
X"make" to terminate once tex exits, it is necessary to type
X
X make -i
X
Xfor the Makefile to be fully processed.
SHAR_EOF
$TOUCH -am 0907232492 README &&
chmod 0444 README ||
echo "restore of README failed"
set `wc -c README`;Wc_c=$1
if test "$Wc_c" != "324"; then
echo original size 324, current size $Wc_c
fi
# ============= mfmake ==============
echo "x - extracting mfmake (Text)"
sed 's/^X//' << 'SHAR_EOF' > mfmake &&
X#! /bin/csh
Xmake -i
SHAR_EOF
$TOUCH -am 0907232492 mfmake &&
chmod 0544 mfmake ||
echo "restore of mfmake failed"
set `wc -c mfmake`;Wc_c=$1
if test "$Wc_c" != "21"; then
echo original size 21, current size $Wc_c
fi
# ============= setups.tex ==============
echo "x - extracting setups.tex (Text)"
sed 's/^X//' << 'SHAR_EOF' > setups.tex &&
X%%%
X%%% File: setups.tex
X%%%
X
X% abbreviations
X\def\LaTeX{{\rm L\raise.42ex\hbox{\kern-.3em a}\kern-.15em\TeX}}
X\def\PiCTeX{{\rm P\kern-.12em\lower.5ex\hbox{I}\kern-.075emC\kern-.11em\TeX}}
X\font\manual=logo10 % may want to use manfnt here instead
X\def\MF{{\manual META}\-{\manual FONT}}
X\def\PS{{\rm Post}\-{\rm Script}}
X
X
X\noindent{\it Setting up on {\tt UNIX}.}
X
XThis document explains how to set up {\tt mfpic} on one specific
configuration of
Xmachine -- a {\tt UNIX} machine running {\tt csh} and X Windows, with a \PS\
Xcompatible printer. In particular, this document explains how to set
up the {\tt UNIX}
Xenvironment variables for \TeX, \MF, {\tt dvips}, and {\tt xdvi} (which
is a DVI
Xviewer for X Windows). Many of these procedures will be necessary, in
some form or
Xanother, on most machines.
X
XLook at the case of processing the sample file {\tt pictures.tex}.
\TeX\ generates a
XMetafont file {\tt pics.mf}. Then processing {\tt pics.mf} with \MF\
X(using the {\tt UNIX} command ``{\tt mf '\string\mode=localfont; input
pics'}")
Xgenerates the files
X{\tt pics.tfm} and {\tt pics.360gf} (since {\tt pictures.tex} includes
the command
X{\tt \string\magnification=\string\magstep1}). However, when you run
\TeX\ again on
X{\tt pictures.tex}, \TeX\ still can't find the file {\tt pics.tfm}.
This is because
Xthe system default for the {\tt UNIX} path environment variable {\tt
TEXFONTS} doesn't
Xinclude the current directory. This is, in fact, the problem with most of the
Xrelevant environment variables -- \TeX\ can't find {\tt pics.tfm}
because of the
X{\tt TEXFONTS} environment variable, {\tt xdvi} can't find {\tt
pics.360gf} because of
Xthe {\tt XDVIFONTS} environment variable, etc. All of the relevant
variables can be
Xset up properly by installing the {\tt mfpicsetup} script below and
then typing
X``{\tt source mfpicsetup}" at the command prompt (or including this
command in your
X{\tt .cshrc} file).
X
XThere is a more serious problem, though. The printing command ``{\tt
lpr -d}"
X(``{\tt -d}" is the DVI printing option) will
Xnot find local fonts, and there is no environment variable you can
change to make it
Xfind them. The best thing to do in this case is to convert your DVI
file to \PS\
Xformat using {\tt dvips}, then print the \PS\ file. But {\tt dvips}
uses fonts in PK
X(packed pixel) format, not the GF (generic font) format that \MF\
generates. So you
Xneed to run {\tt gftopk} in the file {\tt pics.360gf}. There are
scripts included
Xbelow to make all of these processes easier.
X
XThe scripts included here are all {\tt csh} scripts. You should save
them in one of
Xthe directories that your {\tt PATH} environment variable points to.
The first script
Xsets up the environment variables so that \TeX, {\tt xdvi}, and {\tt
dvips} can all
Xfind the fonts generated by \MF\ in the current directory. You should
save this
Xscript as ``{\tt mfpicsetup}", then include the line ``{\tt source
mfpicsetup}" in
Xyour {\tt .cshrc} file. The last line of this script makes sure that
{\tt xdvi} looks
Xfor the font in the appropriate resolution.
X
X\par{\tt \#!/bin/csh}
X\par{\tt set A=\$TEXFONTS}
X\par{\tt setenv TEXFONTS .:\$A}
X\par{\tt set A=\$TEXPKS}
X\par{\tt setenv TEXPKS .:\$A}
X\par{\tt set A=\$XDVIFONTS}
X\par{\tt setenv XDVIFONTS .:\$A}
X\par{\tt alias xdvi 'xdvi -p 300 -s 3'}
X
X\noindent
XThe next script allows you to process a \TeX\ file containing {\tt mfpic}
Xcommands and generate the fonts all in one step. It will automatically
go through the
Xfirst two steps (processing with \TeX\ and processing with \MF) -- with the
X``{\tt -n}" option (mnemonic for ``new file"), it will also include the
third step,
Xreprocessing with \TeX. You must include {\it both} the name of the
\TeX\ file and
Xthe name of the \MF\ file it generates. You should save this
Xscript as ``{\tt domfpic}" -- then, for example, the command
X
X\par{\tt domfpic -n pictures pics}
X
X\noindent will go through all three steps for {\tt pictures.tex},
generating the files
X{\tt pictures.dvi}, {\tt pics.mf}, {\tt pics.tfm}, and {\tt
pics.360gf}. This will
Xallow you to view {\tt pictures.dvi} with {\tt xdvi}.
X
X\par{\tt \#!/bin/csh}
X\par{\tt set OPT=-n}
X\par{\tt if (\$1 == \$OPT) then}
X\par{\tt tex \$2}
X\par{\tt mf '\string\mode=localfont;' input \$3}
X\par{\tt tex \$2}
X\par{\tt else}
X\par{\tt tex \$1}
X\par{\tt mf '\string\mode=localfont;' input \$2}
X\par{\tt endif}
X
X\noindent
XThe next script does the printing -- so it includes the {\tt gftopk} and
X{\tt dvips} steps, along with an {\tt lpr} command. Again, you must include
X{\it both} the name of the \TeX\ file and the name of the \MF\ file it
generates --
Xbut this time you absolutely {\it cannot} include the subscripts {\tt
.tex} and
X{\tt mf}. This script also cleans up after itself by removing the PK
and \PS\ files
Xwhen it is done. You should save this script as ``{\tt prmfpic}".
X
X\par{\tt \#!/bin/csh}
X\par{\tt foreach B (\$2.*gf)}
X\par{\tt gftopk -v \$B}
X\par{\tt end}
X\par{\tt dvips -Z \$1.dvi}
X\par{\tt lpr \$1.ps}
X\par{\tt rm \$2.*pk}
X\par{\tt rm \$1.ps}
X
X\end
SHAR_EOF
$TOUCH -am 0907232592 setups.tex &&
chmod 0755 setups.tex ||
echo "restore of setups.tex failed"
set `wc -c setups.tex`;Wc_c=$1
if test "$Wc_c" != "5043"; then
echo original size 5043, current size $Wc_c
fi
exit 0
Technical Details
Message-ID:
<1992Sep9.030854.16506@dartvax.dartmouth.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!decwrl!bu.edu!dartvax!griggs.dartmouth.edu!leathrumShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!decwrl!bu.edu!dartvax!griggs.dartmouth.edu!leathrum From: leathrum@griggs.dartmouth.edu (Thomas Leathrum) Newsgroups: comp.text.tex Subject: mfpic -- setting up Message-ID: <1992Sep9.030854.16506@dartvax.dartmouth.edu> Date: 9 Sep 92 03:08:54 GMT Sender: news@dartvax.dartmouth.edu (The News Manager) Reply-To: leathrum@griggs.dartmouth.edu (Thomas Leathrum) Followup-To: comp.text.tex Organization: Dept. of Math and Computer Science, Dartmouth College Lines: 392